AutosarC++17_10-M6.5.3

The loop-counter shall not be modified within condition or statement

Required inputs: IR

Rationale

Modification of the loop-counter other than in expression leads to a badly-formed for loop.

Example
bool modify ( int32_t * pX ) 
{
*pX++;
return ( *pX < 10 );
}
for ( x = 0; modify ( &x ); ) // Non-compliant
{
}
for ( x = 0; x < 10; )
{
x = x * 2; // Non-compliant
}

Note

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