MISRA C:2012 Rule 20.12
A macro parameter used as an operand to the # or ## operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators
Description
Rule Definition
A macro parameter used as an operand to the # or ## operators, which is itself subject to further macro replacement, shall only be used as an operand to these operators.
Rationale
The parameter to #
or ##
is
not expanded prior to being used. The same parameter appearing elsewhere
in the replacement text is expanded. If the macro parameter is itself
subject to macro replacement, its use in mixed contexts within a macro
replacement might not meet developer expectations.
Additional Message in Report
Expanded macro parameter param1
is
also an operand of op
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.
Check Information
Group: Preprocessing Directives |
Category: Required |
AGC Category: Required |