The use of parentheses, even those not required to enforce a desired order of operations, can clarify the intent behind a piece of code. But
redundant pairs of parentheses could be misleading, and should be removed.
Noncompliant Code Example
int x = (y / 2 + 1); //Compliant even if the parenthesis are ignored by the compiler
if (a && ((x+y > 0))) { // Noncompliant
//...
}
return ((x + 1)); // Noncompliant
Compliant Solution
int x = (y / 2 + 1);
if (a && (x+y > 0)) {
//...
}
return (x + 1);