In standard C++ (and C) must
- All of a functions arguments be full evaluated before the function is called.
- No function calls may interleave with one another, a prior function call must be fully done before the next can start.
- Expressions used as function arguments can be evaluated in any order, also interleaved(!) unless this is prohibited by rule 1 or 2.
This means that in the expression
then expression1 and expression2 must be evaluated before func is called, but we don’t know which of them is evaluated first.
In the more complicated example of
then we know that
- expression1 is evaluated before g
- expression2 is evaluated before h
- both g() and h() are evaluated before f() is called.
However, we don’t know if
- expression1 or expression2 is evaluated first
- g() or h() is evaluated first
- expression1 is fully evaluated before h() is called (!)