MISRA.CONTINUE.ILLContinue statement is used in an ill-formed for loop. MISRA-C++ Rule 6-3-3 (required): The continue statement shall only be used within a well-formed for loop.RationaleOver-use of the continue statement can lead to unnecessary complexity within the code. This complexity may impede effective testing as extra logic must be tested. The required testing may not be achievable due to control flow dependencies. A well-formed for loop is one which satisfies Rule 6—5—1 to Rule 6—5—6. Examplevoid fn ( ) { for ( int32_t i = 0 ; i != 10; ++i ) { if ( ( i % 2 ) == 0 ) { continue; // Compliant } // ... } int32_t j = -1; for ( int32_t i = 0 ; i != 10 && j != i; ++i ) { if ( ( i % 2 ) == 0 ) { continue; // Non-compliant — loop is not well-formed } // ... ++j; } } |