Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 18.4 using -- operator for pointers
#2
Rule 18.4 prohibits the use of "+, -, +=, -=" operators on expressions with a pointer type. All other operators that are legal C do not violate this rule. This includes ++ and --, both prefix and postfix.

The rationale mentions the ++ operator as an example of a valid operator that is not restricted by this rule. It was not intended that the rationale should list all valid operators.

As a general point, it should be remembered that the rationale section is not normative. Only the guideline headline and amplification (where present) are intended to specify which operators the guideline applies to.
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)