home > resources > c++ coding standard > online version

Parenthesis Policy

  • Do not put parens next to keywords. Put a space between.
  • Do put parens next to function names.
  • Do not use parens in return statements when it's not necessary.

Justification

  • Keywords are not functions. By putting parens next to keywords, keywords and function names adopt a similar look while they have completely different semantic meanings.

Example 3-4. Parenthesis Policy Example

if (condition)
{
}
    
while (condition)
{
}
    
strcpy(s, s1);
    
return 1;