Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 13.2 Compliance
#3
The amplification of rule 13.2 states that no object shall be modified more than once within a full expression. Therefore the code "(x = a) && (x = b)" will violate rule 13.2.

The rule does not take into account the possible values that an object might take. The initialisation of a to 0 before this line does not effect the compliance of the expression with this rule.

The expression does violate rules 10.1 (assuming int x), 13.4 and 13.5.
If the expression is preceded by "int a = 0;" the code will also violate rule 2.1. Rule 14.3 will be violated if the expression is used within a controlling expression.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)