我下J.1不確定的行爲看着SO/IEC 9899:201x:子表達式計算順序
"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)."
這是否意味着,在
func1() + func2();
FUNC2()可以被FUNC1()之前預先形成,或即使在func1()期間?
是的,加號運算符是一個序列點,請參閱http://en.wikipedia.org/wiki/Sequence_point – 2009-11-16 23:27:28
在目前的標準:6.5/10,我相信。 – 2009-11-16 23:29:27
加號運算符本身並不意味着一個序列點,但是因爲它的參數都是函數調用,所以在求值之前有兩個序列點。 – 2009-11-16 23:31:05