05-12-2025, 01:25 PM
The definitions were intended to be taken from the rule text, so the first three lines of the amplification:
"The init-statement only declares and initializes a loop-counter of integer type; and
The condition only compares the loop-counter to a loop-bound using a relational operator; and
The loop-counter is modified, but only by incrementing or decrementing by a loop-step within the expression of the for statement; and ..."
(where init-statement, condition and expression are C++ terms, see #9.5.3)
were intended to be read as:
The init-statement only declares and initializes an object of integer type, known as the 'loop-counter'; and
The condition only compares the loop-counter to an expression (known as the 'loop-bound') using a relational operator; and
The loop-counter is modified, but only by incrementing or decrementing by a value within the expression of the for statement, known as the
'loop-step '; and ..."
We agree that this could be clearer. We believe that this is equivalent to the rule in 2008
"The init-statement only declares and initializes a loop-counter of integer type; and
The condition only compares the loop-counter to a loop-bound using a relational operator; and
The loop-counter is modified, but only by incrementing or decrementing by a loop-step within the expression of the for statement; and ..."
(where init-statement, condition and expression are C++ terms, see #9.5.3)
were intended to be read as:
The init-statement only declares and initializes an object of integer type, known as the 'loop-counter'; and
The condition only compares the loop-counter to an expression (known as the 'loop-bound') using a relational operator; and
The loop-counter is modified, but only by incrementing or decrementing by a value within the expression of the for statement, known as the
'loop-step '; and ..."
We agree that this could be clearer. We believe that this is equivalent to the rule in 2008
Posted by and on behalf of
the MISRA C++ Working Group
the MISRA C++ Working Group

