Save=0;
bool checking() const; ///declaration
inline bool isZombie() const //definition
{ if(Save==0) {return cc_t < 0}
if(Save==1) {return cc_i < 0;}
}
這是一個非常天真的問題。我明白代碼中錯誤的含義。任何人都可以告訴我,爲什麼它不接受條件中的退貨聲明。 如果我寫上面的代碼爲不返回,在函數返回非void {在日食CDT}
bool checking() const //definition
{ if(Save==0) {return cc_t < 0}
else {return cc_i < 0;}
}
那麼,沒有警告..?
什麼是 '保存' 的類型? –
只是因爲這種方式'返回'聲明可能永遠達不到 – DimChtz
你的代碼缺少';',否則它是合法的,如果一個壞主意。警告是因爲如果保存爲3,您的代碼將執行未定義的行爲。 – Yakk