...
Failing to parenthesize macro replacement lists can cause unexpected results.
Recommendation | Severity | Likelihood | Remediation Cost | Priority | Level |
---|---|---|---|---|---|
PRE02-C | Medium | Probable | Low | P12 | L1 |
Automated Detection
Tool | Version | Checker | Description | ||||||
---|---|---|---|---|---|---|---|---|---|
Axivion Bauhaus Suite |
| CertC-PRE02 | |||||||
CodeSonar |
| LANG.PREPROC.MACROEND LANG.PREPROC.MACROSTART | Macro Does Not End With ) or } Macro Does Not Start With ( or { | ||||||
| CC2.PRE02 | Fully implemented | |||||||
Helix QAC |
| C3409 | |||||||
Klocwork |
| MISRA.DEFINE.BADEXP |
LDRA tool suite |
| 77 S | Fully implemented | ||||||
Parasoft C/C++test |
| CERT_C-PRE02-a | Enclose in parentheses whole definition of a function-like macro | |||||||
PC-lint Plus |
| 773, 973 | Fully supported |
Related Vulnerabilities
Search for vulnerabilities resulting from the violation of this rule on the CERT website.
Related Guidelines
SEI CERT C++ Coding Standard | VOID PRE02-CPP. Macro replacement lists should be parenthesized |
ISO/IEC TR 24772:2013 | Operator Precedence/Order of Evaluation [JCW] Pre-processor Directives [NMP] |
Bibliography
[Plum 1985] | Rule 1-1 |
[Summit 2005] | Question 10.1 |
...
...