精華區beta Programming 關於我們 聯絡資訊
※ 引述《khoguan (Khoguan Phuann)》之銘言: : 不用客氣 ^_^ : 經由反覆辯難與思考,相信大家彼此都學到了新的東西。 : 上表中,「有初始化,但沒用到」那種情形,我剛才用一個很簡單的 : 例子,在 VC++ 7.1 下測試: : int main() : { : int a = 0, b = a; : } 嗯..其實我有個疑惑 真的可以寫 int a=0,b=a; 嗎? 總覺得怪怪的 剛才去翻了一下 K&R 2/e SECTION 3.6 p.63 頭兩行 "The commas that separate function arguments, variables in declarations ,etc., are not comma operators, and do not guarantee left to right evaluation." 以前就是因為記著這個 所以我一直避免同一個宣告式裡面,後面的變數參考前面的 不管是寫 C 還是 C++ ..雖然我用 VC 跟 gcc 試驗編譯都會過,執行結果也對.. 還是說 C++ 規格訂得不一樣呢 -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 61.70.137.117