27-04-2012, 08:35 AM
The presence of a parenthesised, possibly empty, parameter list in the definition of a macro makes it a function-like macro. See the C90 standard, Section 6.8.3.
This means that all of:
are function-like macros and therefore contain instances of the # preprocessing operator.
The # preprocessing operator must be followed by a parameter (constraint C90 Section 6.8.3.2). Therefore none of the above examples is legal C.
This means that all of:
Code:
#define QWER(x) { asm x ASDF #$7F; }
#define QWER(x) { asm ASDF #$7F; }
#define QWER() { asm ASDF #$7F; }
The # preprocessing operator must be followed by a parameter (constraint C90 Section 6.8.3.2). Therefore none of the above examples is legal C.
Posted by and on behalf of the MISRA C Working Group