V787. A wrong variable is probably used as an index in the for statement.


The analyzer detected a loop counter used as an index in the loop termination condition. Such code looks suspicious.

Consider the following example:

for (int i = 0; i < n; ++i)
  for (int j = 0; j < arr[j]; ++j)
    ....

The programmer must have intended to use the variable 'i' instead of 'j':

for (int i = 0; i < n; ++i)
  for (int j = 0; j < arr[i]; ++j)
    ....

Bugs Found

Checked Projects
334
Collected Errors
12 668