推 firose:undefined behavior 02/04 01:00
→ kobe123:啥意思@@? 02/04 01:01
→ kobe123:Z+Z=-2 , Z=Z+1=-1 為啥變0 02/04 01:02
推 chrisdar:int z = -1; 02/04 01:12
→ chrisdar::cout<<z + z<<endl; 02/04 01:12
→ chrisdar:z++ // 0 02/04 01:12
→ chrisdar::cout<<z + z<<endl; 02/04 01:12
→ chrisdar:z++ // 1 02/04 01:12
推 chrisdar:推壞了 std::cout<<z + z<<endl;z++; 02/04 01:14
→ kobe123:Z++那裏要用原來的z來算答案就對了...太粗心了orz||| 02/04 01:21
→ LPH66:正解是一樓 未定義行為 因為你在z++還沒結算前又去抓z 02/04 01:36
→ LPH66:這樣z++的時間點是隨人實作的 02/04 01:36
→ LPH66:(應該說隨compiler實作) 02/04 01:36
→ LPH66:參考置底十誡之九 02/04 01:37
→ softwind:萬年OP阿 ... 02/04 01:52
→ kobe123:恩恩感謝...忘了看置底0.0 02/04 02:25