Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 9.5.1 - Missing definitions
#1
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.
Reply
#2
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
Posted by and on behalf of
the MISRA C++ Working Group
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)