# Sequenced expressions

suggest changeThe following expressions are *sequenced*:

a && b a || b a , b a ? b : c for ( a ; b ; c ) { ... }

In all cases, the expression `a`

is fully evaluated and *all side effects are applied* before either `b`

or `c`

are evaluated. In the fourth case, only one of `b`

or `c`

will be evaluated. In the last case, `b`

is fully evaluated and all side effects are applied before `c`

is evaluated.

In all cases, the evaluation of expression `a`

is *sequenced before* the evaluations of `b`

or `c`

(alternately, the evaluations of `b`

and `c`

are *sequenced after* the evaluation of `a`

).

Thus, expressions like

x++ && x++ x++ ? x++ : y++ (x = f()) && x != 0 for ( x = 0; x < 10; x++ ) { ... } y = (x++, x++);

have well defined behavior.

Found a mistake? Have a question or improvement idea?
Let me know.

Table Of Contents