精華區beta Programming 關於我們 聯絡資訊
※ 引述《ImOnLine (So be it)》之銘言: : ※ 引述《Lordaeron (Terry)》之銘言: : : 不過. intel base 的 : : VC6/7, g++, watcom c++, TC++ 3 全都是27, 不知有誰找一套 : : 出來可以算出別的答案的? : : 可能要找天去開台SOLARIS 和AIX 再來看看. : 我剛使用IBM iSeries 的機器計算。 : 算出來的結果為26。 : x= 12; x = x++ + ++x; cout<<x; : 我本來以為程式可以很簡單的拆成下列幾行來看: : + 的 associativty is right to left: : so : temp1= x++; //temp1 = 12, x = 13. : temp2 = ++x; // temp2 = 14, x=14. : x = temp1 + temp2; // x = 12 + 14 = 26. : 但以上結果只有在iSeries上正確。在pc上用VS.net 2003 & dev c++運算結果都是27。 : 先x++, 而cout<<x 在pc上結果為13,但在iSeries為12。 : 而用linux 的anjuta 運算結果還是27啊. : so intel's x86 should be this: : x = x++; // x = 13. : temp1 = x; //temp1 = 13 : temp2 = x+1; // temp2 = 14, x=14. : x = temp1 + temp2; // x = 13 + 14 = 27 : anyquestion??? : I DON'T know how to type chinese character in SUSE linux....so........ 請問你在aix 上用哪一套C++ 呢? 版本也講一下可以嗎? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.229.153.213