MISRA.FOR.LOOP_CONTROL.NOT_BOOLEANLoop control variable is not boolean. MISRA-C++ Rule 6-5-6 (required): A loop-control-variable other than the loop-counter which is modified in statement shall have type bool.Rationaleloop-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). Examplefor ( 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; } |