Why is this an issue?
The evaluation order of both the #
and ##
preprocessor operators is unspecified. Compilers have been known to implement
these operators inconsistently, therefore, to avoid these problems, do not use them.
Noncompliant code example
#define A(Y) #Y /* Noncompliant */
#define A(X,Y) X##Y /* Noncompliant */
Resources
- MISRA C:2004, 19.13 - The # and ## preprocessor operators should not be used.
- MISRA C++:2008, 16-3-2 - The # and ## operators should not be used.
- MISRA C:2012, 20.10 - The # and ## preprocessor operators should not be used