Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
13.5 Loop control expression inconsistencies
#1
Dear Misra Committee,

Going through the previous posts on the rule 13.5, I found an inconsistency between the answers given in:
1) http://www.misra.org.uk/forum/viewtopic.php?f=69&t=272
2) http://www.misra.org.uk/forum/viewtopic.php?f=69&t=874

In the first post, the following was posted:

Quote:...
Loop Control Variable is defined as any variable occurring in the first, second or third expressions.

Loop Counter is defined as a Loop Control Variable which is,
• Initialised in the first expression or Initialised prior to first expression;
• In the second expression, the operand of a relational operator (= ); Note (1)
• In the third expression, always incremented or decremented by a constant, or an expression which evaluates to the same value for the duration of the loop;
• Not modified in the body of the loop.
...
Note 1: The equality operators (==, !=) should not be used because termination of the loop may not occur.
...

In the second post, the following example was given and was confirmed to be compliant with MISRA C 13.5.

[code]
bool Test_Index(int32_t index, int32_t bound){
return (bool)(p
<r>Dinesh Bolkensteyn<br/>
<URL url="http://www.SonarSource.com"><s></s>www.SonarSource.com<e></e></URL><br/>
<URL url="http://twitter.com/DBolkensteyn"><s></s>twitter.com/DBolkensteyn<e></e></URL></r>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)