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

Rule: automatically with code checker

Synopsis:Side effects shall not be relied upon between successive sequence points.
Severity Level:3
Category:Conceptual Models



For a few constructs in C, the standard does not define the evaluation order when there is more than one side-effect in it. Reliance on them can create problems which are very difficult to track down. Note that this even may occur with the same compiler but a different set of compiler options.

Example 1

x = i++ + a[i]; /* WRONG */
y = f() + g() /* WRONG */

Example 2

x = i + a[i]; /* RIGHT */

Example 3

y = f(); /* RIGHT */
y += g();


It is best practice not to have two function calls in one statement, but usage of functions with no (or neglectable) side effects can be used.

double d = sin(x) + fabs(x); /* RIGHT */