MISRAC++2023-9.5.1_a (C++ only)
In this section:
Synopsis
(Advisory) Legacy for statements should be simple
Enabled by default
No
Severity/Certainty
Low/High

Full description
Legacy for init-statement shall only declare and initialize a loop counter of integer type.
Coding standards
This check does not correspond to any coding standard rules.
Code examples
The following code example fails the check and will give a warning:
void example() {
int i = 0;
for (; i < 10; ++i ) {} // Non-Compliant
}
The following code example passes the check and will not give a warning about this issue:
void example() {
for (int i = 0; i < 10; ++i ) {} // Compliant
}