Let's say we have class A
:
class A {
public:
A& func1( int ) { return *this; }
A& func2( int ) { return *this; }
};
and 2 standlone functions:
int func3();
int func4();
now in this code:
A a;
a.func1( func3() ).func2( func4() );
is order of evaluation of functions func3()
and func4()
defined?
According to this answer Undefined behavior and sequence points one of the sequence points are:
- at a function call (whether or not the function is inline), after the evaluation of all function arguments (if any) which
takes place before execution of any expressions or statements in the function body (
§1.9/17
).
So does "evaluation of all function arguments" mean, func3()
has to be called before func4()
as evaluation of func1()
arguments has to happen before call of func2()
?