Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No operators in #if
#9
The MISRA guidelines define "code" in the Glossary as
Quote:"Code consists of everything within a translation unit that is not excluded by conitional compilation."
All guidelines apply to code after preprocessing directives have been executed, unless otherwise stated in a guideline. Therefore rule 10.1 does not apply.

Even if the examples where visible after expansion, they should not produce a 10.1 violation if the tool is configured to recognise TRUE as having an essentially boolean types (See Appendix D.6)For example:
Code:
#define TRUE 1
#define Condition1 TRUE
#define Condition2 TRUE
if ( Condition1 && Condition2  ) // No violation of rule 10.1 if TRUE is identified as an essentially boolean type
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)