Appleの最悪な脆弱性で再燃のgoto不要論 ← 馬鹿?
■ このスレッドは過去ログ倉庫に格納されています
0001デフォルトの名無しさん
2014/02/23(日) 19:18:14.11> if ((err = SSLHashSHA1.update(&hashCtx, &serverRandom)) != 0)
> goto fail;
> if ((err = SSLHashSHA1.update(&hashCtx, &signedParams)) != 0)
> goto fail;
> goto fail;
> if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
> goto fail;
馬鹿いわく、gotoなんか使うな!
↓ 本当かね? じゃあ例外に置き換えてみよう。
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0)
throw new Exception();
throw new Exception();
ありゃりゃ、例外使っても同じことでした。
正しくは、「一行であっても { } で括ること」いうコーディング規約は正しいということ。
if ((err = SSLHashSHA1.final(&hashCtx, &hashOut)) != 0) {
goto fail;
}
goto fail;
ほら、間違いにすぐ気づく
■ このスレッドは過去ログ倉庫に格納されています