AutosarC++19_03-M6.5.6

A loop-control-variable other than the loop-counter which is modified in statement shall have type bool

Required inputs: IR

Rationale

loop-control-variables are typically used to terminate a for loop early. The code is easier to understand if this is done with the use of Boolean values (flags).

Example
for ( x = 0; ( x < 10 ) && ( u8a != 3U ); ++x )      // Non-compliant 
{
uint8_a = fn ( );
}
for ( x = 0; ( x < 10 ) && flag; ++x ) // Compliant
{
u8a = fn ( );
flag = u8a != 3U;
}

Note

For legal reasons, this rule’s description is not part of the public documentation.