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

SR:  7#1Checked automatically with code checker

Synopsis:Expressions which either mix operators from the set >, >=, <, <=, ==, !=, with operators from the set <<, >>, ^, &, |, &&, || or which use two or more distinct operators from the latter set shall be fully parenthesised and make no use of the C precedence rules.
Language:C
Severity Level:6
Category:EXPRESSIONS


Description:
Mixing relational and logical operators without explicit parenthesisation is a notorious source of error in C programs.

Example:

if ( a == b && c == d ) /* WRONG - precedence used */
if ((a == b ) && ( c == d )) /* RIGHT */