18-11-2021, 10:33 AM
In this case, you are right, there is no loop counter, so the rules don't apply.
The definitions in the introductory section are expressed in terms of the 'for loop' syntax, and show the equivalence of a 'for loop' and 'while loop'. This shows the while loop as 'while (condition)'. The definition of loop-counter requires it to be a loop-control-variable that is "an operand to a relational operator in condition". As there are no relational operators in the condition in the example code, there is no loop-counter
The definitions in the introductory section are expressed in terms of the 'for loop' syntax, and show the equivalence of a 'for loop' and 'while loop'. This shows the while loop as 'while (condition)'. The definition of loop-counter requires it to be a loop-control-variable that is "an operand to a relational operator in condition". As there are no relational operators in the condition in the example code, there is no loop-counter
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group