![]() |
|
Rule 9.5.1 - Missing definitions - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=188) +---- Forum: 4.9 Statements (https://forum.misra.org.uk/forumdisplay.php?fid=195) +---- Thread: Rule 9.5.1 - Missing definitions (/showthread.php?tid=1759) |
Rule 9.5.1 - Missing definitions - cgpzs - 02-12-2025 Rule 9.5.1 talks about concepts like `init-statement`, `loop-counter`, etc which have not been defined anywhere in the document. `loop-counter` for example is a MISRA term and not a C++ Standard term. The old MISRA C++:2008 rules did precisely define these concepts before they were used. So I think MISRA C++:2023 should do the same. RE: Rule 9.5.1 - Missing definitions - misra cpp - 05-12-2025 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 |