2017.08.03
linux下gcc3.4.5下編譯通過好的含goto語句c程序,goto跳轉(zhuǎn)到end
使用gcc4.8.2 遇上一下錯誤提示
error: jump to label ‘end’
error: from here
error: crosses initialization of ‘int x’
error: crosses initialization of ‘int y’
gcc4.8.2在跳轉(zhuǎn)之后還有變量聲明的話带饱,它認(rèn)為后面定義的變量在跳轉(zhuǎn)label定義時尚未初始化搜骡,故而編不過去
把所有的變量聲明放到第一個goto跳轉(zhuǎn)之前就行合住。