[previous] MISRA-C:2004  Rule  19.12:  (Required) [next] There shall be at most one occurrence of the # or ## preprocessor operators in a single macro definition.
There is an issue of unspecified order of evaluation associated with the # and ## preprocessor operators. To avoid this problem only one occurrence of either operator shall be used in any single macro definition (i.e. one #, or one ## or neither).

Example Code:


/* PRQA S 3429 ++ */

#include "misra.h"
#include "m2cmex.h"

#define PASTE( front, middle, back ) ( #front##middle##back ) /* MISRA Violation */
#define TWOST(A,B) #A #B                                      /* MISRA Violation */

extern S16 test_1912( void )
{
   return 1;
}


QAC messages that encompass this guideline:

0880 Using # and ## operators in the same macro definition.
0881 Using multiple ## operators in the same macro definition.
0884 Using multiple # operators in the same macro definition.



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