MISRA C:2012 Rule 20.11
A macro parameter immediately following a # operator shall not immediately be followed by a ## operator
Description
Rule Definition
A macro parameter immediately following a # operator shall not immediately be followed by a ## operator.
Rationale
The order of evaluation associated with multiple #
,
multiple ##
, or a mix of #
and ##
preprocessor
operators, is unspecified. Rule 20.10 discourages the use of #
and ##
.
The result of a #
operator is a string literal.
It is extremely unlikely that pasting this result to any other preprocessing
token results in a valid token.
Additional Message in Report
The ## preprocessor operator shall not follow a macro parameter following a # preprocessor operator.
Troubleshooting
If you expect a rule violation but do not see it, refer to Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Preprocessing Directives |
Category: Required |
AGC Category: Required |