Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 12.5: OR sequence without parentheses not compliant?
#5
Yes, the rule applies to preprocessing expressions in exactly the same way as it would to other expressions.

Since the defined operator is a unary operator, it will need parentheses, in much the same way as a function call would require parentheses in a non-preprocessing expression. So, the example would need to be written:

Code:
#if (!defined(__cplusplus)) || (defined(__STDC_LIMIT_MACROS))
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)