throw()
コンパイラはC++で変数設定と操作を並べ替えることができますか?または、標準のC ++ 14882-1998は、この変換のコンパイラーを許可または禁止していますか?
コードの場合:
bool funct()
{
bool succeeded = false;
bool res_throw = false;
try {
throw("it");
succeeded = true;
}
catch(...) {
res_throw = true;
}
cout << "Result of throw: " << res_throw << endl;
cout << "succeeded: " << succeeded << endl;
return succeeded;
}
出力は
Result of throw: true
succeeded: true
標準によると:「[intro.execution]#7」:
オブジェクトの変更..はすべて副作用であり、実行環境の状態の変化です。
シーケンスポイントと呼ばれる実行シーケンスの特定の指定されたポイントで、前の評価のすべての副作用が完了し、後続の評価の副作用が発生していないものとします。
throw
ステートメントはシーケンスポイントですか?