17-01-2018, 04:37 PM
Your example violates rule 6-5-4
i is a loop counter (initialised before the condition, tested with a relational operator in the condition and modified in the expression).
6-5-4 requires that the loop counter shall only be modified by one of ++ -- += n or -= n where n is constant for the duration of the loop
i is a loop counter (initialised before the condition, tested with a relational operator in the condition and modified in the expression).
6-5-4 requires that the loop counter shall only be modified by one of ++ -- += n or -= n where n is constant for the duration of the loop
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group