C++ uses lazy evaluation for logical operators.
If you write a || b
, and a
is true, b
will never evaluate, since the result will be true even if b
is false.
Similarly, a && b
will not evaluate b
if a
is false.
Since ++i
evaluates to a truthy value, none of the other expressions are evaluated.