MISRA C++:2008 Rule 16-3-1
There shall be at most one occurrence of the # or ## operators in a single macro definition
Description
Rule Definition
There shall be at most one occurrence of the # or ## operators in a single macro definition.
Rationale
The evaluation of the # and ## preprocessor operators does not have a specified execution order. When more than one occurrence of the # or ## operators exists in a single macro definition, it is unclear which preprocessor operator is executed first by the compiler. The uncertainty of execution order might result in developer confusion or unexpected macro calculations. Use only one of the # or ## preprocessor operators for each macro definition.
Polyspace Implementation
Polyspace® raises this defect whenever more than one instance of the # or ## operators is used in a single macro definition.
Troubleshooting
If you expect a rule violation but Polyspace does not report it, see Diagnose Why Coding Standard Violations Do Not Appear as Expected.
Examples
Check Information
Group: Preprocessing Directives |
Category: Required |
Version History
Introduced in R2013b