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 relational and/or logical 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.

Example:

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