This rule is part of MISRA C++:2023.
Usage of this content is governed by Sonar’s terms and conditions. Redistribution is
prohibited.
Rule 19.3.1 - The # and ## preprocessor operators should not be used
[cpp.stringize] Unspecified 2
[cpp.concat] Unspecified 3
Category: Advisory
Analysis: Decidable,Single Translation Unit
Rationale
The order of evaluation associated with multiple #, multiple ## or a mix of # and ##
preprocessor operators is unspecified. It is therefore not always possible to predict the result of macro expansion.
The use of the ## operator can result in code that is hard to understand.
Note: M23_393: MISRA C++ 2023 Rule 4.1.3 covers the undefined behaviour that arises if either:
- The result of a
# operator is not a valid string literal; or
- The result of a
## operator is not a valid preprocessing token.
Copyright The MISRA Consortium Limited © 2023