Show: Delphi C++
Display Preferences

DeadStores -- Expression Value is Not Used

From RAD Studio
Jump to: navigation, search

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--) {
     ...
   }
   ...
 }

See Also

Personal tools
RAD Studio 10.2 Tokyo
In other languages
Previous Versions
Assistance