DeadStores -- Expression Value is Not Used
Go Up to C++ Audits
Description
Checks for values stored to variables that are never read afterwards.
For example, DeadStores detects situations where the expression value is not used. For example, a variable is subsequently assigned two expressions. This message is also reported if the object produced by the new operator is not used, and the object creation operation has no side effects.
Incorrect
void copy(List& from, List& to) {
int i = from.size();
for (i = from.size() - 1; i >= 0; i--) {
...
}
...
}
Correct
void copy(List& from, List& to) {
for (int i = from.size() - 1; i >= 0; i--) {
...
}
...
}