MISRAC++2008-6-5-2
In this section:
Synopsis
(Required) If loop-counter is not modified by -- or ++, then, within condition, the loop-counter shall only be used as an operand to <=, <, > or >=.
Enabled by default
Yes
Severity/Certainty
Low/Low

Full description
A loop counter was found that might not match the loop condition test.
Coding standards
- CERT MSC21-C
Use robust loop termination conditions
- CERT MSC21-CPP
Use inequality to terminate a loop whose counter changes by more than one
Code examples
The following code example fails the check and will give a warning:
void example(void)
{
for(int i = 0; i != 10; i += 2) {}
}
The following code example passes the check and will not give a warning about this issue:
void example(void)
{
for(int i = 0; i <= 10; i+= 2) {}
}