It can be extremely confusing when a for
loop’s counter is incremented outside of its increment clause. In such cases, the increment
should be moved to the loop’s increment clause if at all possible.
for (i = 0; i < 10; j++) { // Noncompliant // ... i++; }
for (i = 0; i < 10; i++, j++) { // ... }
Or
for (i = 0; i < 10; i++) { // ... j++; }