Parenthesize all parameter names in macro definitions. See also recommendations PRE00-C. Prefer inline or static functions to function-like macros and PRE02-C. Macro replacement lists should be parenthesized.
...
Code Block |
---|
#define JOIN(a, b) (a ## b) #define SHOW(a) printf(#a " = %d\n", a) |
See recommendation PRE05-C. Understand macro replacement when concatenating tokens or performing stringification for more information on using the ##
operator to concatenate tokens.
...
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
| 78 S | Fully Implemented | |||||||
| macrbody | Fully Implemented |
...
Tool
...
Version
...
Checker
...
Description
...
Section |
---|
...
Section |
---|
78 S |
...
Section |
---|
Fully Implemented |
...
Section |
---|
...
Section |
---|
macrbody |
...
Section |
---|
Fully Implemented |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
...
CERT C++ Secure Coding Standard: PRE01-CPP. Use parentheses within macros around parameter names
ISO/IEC 9899:19992011 Section 6.10, "Preprocessing directives," and Section 5.1.1, "Translation environment"
...