9. Operand Evaluation Order

Not specified, except for && || ?: ,     (see also notes on sequence points)

Examples:

  x = f() + g();

  f may be evaluated before g or vice versa.

Similarly, the order in which function arguments are evaluated is not specified.

Note: associativity of addition is LR:

  x = f() + g() + h();
is equivalent to:
  x = (f() + g()) + h();
Logical AND:
  if( x != 0  &&  1/x < eps) ...

  1/x is not computed if x is zero.

Logical OR:

  if( x == 0  ||  f(x) == 0) ...

  f(x) is not computed if x is zero.

Conditional Operator:

  y = (a < b) ? f(x) : g(x);

  if a is less than b, then f(x) is executed and g(x) is not.

Comma Operator:

  ++i, ++j;

  ++i is executed first and the result is ignored.  ++j is executed second.