[previous] MISRA C:2012  Rule-20.9:  (Required) [next] All identifiers used in the controlling expression of #if or #elif preprocessing directives shall be #define'd before evaluation

Amplification:

As well as using a #define preprocessor directive, identifiers may effectively be #define'd in other, implementation-defined, ways. For example some implementations support:

Example Code:


#include "misra.h"
#include "m3cmex.h"

#if X < 0                               /* 3332 */
#define M 1
#endif

extern int16_t rule_2009( void )
{
   return 1;
}


QAC messages that encompass this guideline:

3332 The macro '%s' used in this '#if' or '#elif' expression is not defined.



(c) The Motor Industry Research Association, 2012
QA C Source Code Analyser 8.1.2
MISRA C:2012 Compliance Module 1.0
© 2013 Programming Research
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents