>
>
>
V787. Wrong variable is probably used i…


V787. Wrong variable is probably used in the for operator as an index.

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