12-03-2009, 10:59 AM
If the macro
is invoked as
then the order of evaluation is important. The result of the ## operator
must be a valid preprocessing token.
Left-to-right evaluation gives 'PRE3' followed by 'PRE3SUF'.
However, the first expansion from right-to-left evaluation is 3SUF, which is
not a valid preprocessing token.
Code:
#define m (a,b) a##3##b
is invoked as
Code:
m ( PRE, SUF ) = 0;
then the order of evaluation is important. The result of the ## operator
must be a valid preprocessing token.
Left-to-right evaluation gives 'PRE3' followed by 'PRE3SUF'.
However, the first expansion from right-to-left evaluation is 3SUF, which is
not a valid preprocessing token.
Posted by and on behalf of the MISRA C Working Group