I've looked at SO/IEC 9899:201x开发者_JAVA百科 under J.1 Unspecified behavior:
"The order in which subexpressions are evaluated and the order in which side effects
take place, except as specified for the function-call (), &&, ||, ?:, and comma
operators (6.5)."
Does this means that in
func1() + func2();
func2() may be preformed before func1(), or even during func1() ?
In the current standard (ISO/IEC 9899:1999) there is a sequence point between function calls but the order of evaluation of the operands to +
is not specified so func1
may be called before or after func2
but the function calls must not overlap or be interleaved in any way.
This means that each of func1
and func2
can, if desired, interact with some shared data without having that data change under it in an unexpected way.
Not during, but sure, either 1 then 2 or 2 then 1.
精彩评论