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.2 - A macro parameter immediately following a # operator shall not be immediately followed by a ##
operator
[cpp.stringize] Unspecified 2
[cpp.concat] Unspecified 3
Category: Required
Analysis: Decidable,Single Translation Unit
Rationale
The order of evaluation associated with multiple #, multiple ## or a mix of # and ##
preprocessor operators is unspecified. The use of # and ## is discouraged by M23_212: MISRA C++ 2023
Rule 19.3.1. In particular, the result of a # operator is a string literal and it is unlikely that pasting this to any other
preprocessing token will result in a valid token.
Example
#define A( x ) #x // Compliant
#define B( x, y ) x ## y // Compliant
#define C( x, y ) x ## #y // Compliant
#define D( x, y ) #x ## y // Non-compliant
Copyright The MISRA Consortium Limited © 2023