Does the standard know anything about how to evaluate subexpressions in the case of sequence points?
The evaluation order is well defined in the case of conditional operators && , as well as || , and that is why working with a short circuit.
It is explicitly specified by the c99 standard.
Reference: c99 Standard
Appendix J: J.1 Undefined behavior
1 The following are unspecified:
.....
The order in which subexpressions are evaluated, and the order in which side effects occur, except as indicated for the calling function (), &, ||,?: And the comma of operators (6.5).
.....
Further,
6.5.14 The logical operator OR
4) Unlike bitwise | operator, || the operator guarantees an assessment from left to right; after evaluating the first operand, there is a point in the sequence. If the first operand is not equal to 0, the second operand is not evaluated.
As for logical AND:
6.5.13 The logical operator AND
Unlike bitwise binary code and operator, && operator guarantees evaluation from left to right; if the second operand is evaluated, then there is a sequence point between the estimates of the first and second operands. If the first operand is compared to 0, the second operand is not evaluated.
source share