[previous] 0872 [next] [U] Result of '##' operator is not a legal preprocessing token.
Explicitly undefined REFERENCE - ISO:C90-6.8.3.3 The ## Operator - Semantics

The result of this glue (##) operation is not a "valid preprocessing token". Valid preprocessing tokens are items such as What this means in practice is that the result of a ## operation must form a single "token".

For example:


/*PRQA S 2017,3120,3121,3211,3408,3429 ++*/

#define MC(x, y) x ## y

int    ia = MC(34, 45);           /* OK             "3445"        is an integer constant            */
double fa = MC(. , 45);           /* OK             ".45"         is a floating constant            */
double fd = MC(12.5 , E01);       /* OK             "12.5E01"     is a floating constant            */
double fb = MC(12. , 45);         /* OK             "12.45"       is a floating constant            */


int    ib = MC(-, 45);            /* Message 0872   "-45"         is an integer constant expression */
int    ic = MC(34*, 45);          /* Message 0872   "34*45"       is an integer constant expression */
double fc = MC(12.5 * , 45.0);    /* Message 0872   "12.5 * 45.0" is a floating constant expression */


MISRA C:2012 Rules applicable to message 0872:

Rule-1.3  (Required) There shall be no occurrence of undefined or critical unspecified behaviour


QA·C Source Code Analyser 8.1
MISRA C:2012 Compliance Module 1.0
© 2012 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index | MISRA C:2012 Rule Index Contents