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

Rule:  6.5.13.a

Synopsis:The right-hand operand of the "&&" or "||" operator shall not contain any side-effects.
Language:C
Severity Level:6
Category:Expressions


Description:

Justification

The right-hand operand of a "&&" or "||" is conditionally executed. Besides, the precedence of operators in C is not intuitive.

Example 1

if ((a > b) && (i++ != 0)) /* WRONG: i not always changed */

Example 2

if ((a > b) && (i != 0)) /* RIGHT */
   ...

}

Example 3

if (a > b)
{
   i++; /* RIGHT */
}