Show: Delphi C++
Display Preferences

SFS -- Suspicious For Statement

From RAD Studio
Jump to: navigation, search

Go Up to C++ Audits

Description

SFS checks for iterator variable usage. It tries to detect a situation where different variables are used in initialization, condition, and the increment part of a for loop. Most likely, it means that the wrong variable is used.

Incorrect

 for (int i = 0; i < lengthX; i++) { 
   for (int j = 0; j < lengthY; i++) {
      ...
   }
 }

Correct

 for (int i = 0; i < lengthX; i++) { 
   for (int j = 0; j < lengthY; j++) { 
     ...
   }
 }

See Also

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