TICS Coding Standard Viewer 
TIOBE Software Quality Framework
Print-friendly version
©TIOBE Software www.tiobe.com
 
C++ Coding Standard
Search

Rule:  CFL#019Checked automatically with code checker

Synopsis:Use explicit parentheses when using multiple different operators in an expression
Language:C++
Severity Level:9
Category:Control Flow


Description:

Without parentheses, it is easy to make mistakes when relying on precedence rules. Comparison and unary operators are excluded from this rule.

Example:

if ( a || b && c || d )   // wrong: incorrect reliance on precedence
if ((a || (b && c) || d) // right: parentheses for correct evaluation