2012-11-29 44 views

回答

3

behaviour is undefined因爲改變一個變量兩個控制順序點之間兩次。

c99 standard : 5.1.2.3 Program execution 
"Accessing a volatile object, modifying an object, modifying a file, or calling a function 
that does any of those operations are all `side effects` which are changes in the state of 
the `execution environment`. Evaluation of an expression may produce side effects. At 
certain specified points in the execution sequence called `sequence points`, all side effects 
of previous evaluations shall be complete and no side effects of subsequent evaluations 
shall have taken place." 

這裏要修改可變a兩者之間兩次序列點。

擴展編輯:如果你知道這些概念已經和思維有關,逗號操作符是一個序列點,所以應該作爲一個well defined工作program.Then你錯在函數調用這裏使用,comma separatorcomma operator

相關問題