Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

When the parameter names are surrounded by commas in the replacement text, regardless how complicated the actual arguments are, there is no need for parenthesization around the macro parameters.  Since commas have lower precedence than any other operator, there is no chance of the actual arguments being parsed in a surprising way.

No Format
 #define #define FOO(a, b, c) bar(a, b, c)
/* ... */  
FOO(arg1, arg2, arg3);  

Risk Assessment

Failing to parenthesize around the parameter names within a macro can result in unintended program behavior.

Rule Recommendation

Severity

Likelihood

Remediation Cost

Priority

Level

PRE01-A

1 (low)

1 (unlikely)

3 (low)

P3

L3

...