4 ms·
I seriously don't understand why so many people don't habitually use braces there... if (...) { goto fail; } if (...) { goto fail; goto fail;
by temujin 13y ago
I seriously don't understand why so many people don't habitually use braces there...
if (...) {
goto fail;
}
if (...) {
goto fail;
goto fail;
}
if (...) {
goto fail;
}
tada, not actually a bug!
- rsfinn 13y agoWhich is fine, but in my experience flaws like this are often introduced via automated merges that could as easily have resulted in: if (...) { goto fail; } if (...) { goto fail; } goto fail; if (...) { goto fail; } which produces the same bug. (Everyone's been shouting about "braces in single statement if clauses" as though they're an absolute fix; they're not, although they're a good idea in general. And yes, code review, better merge tools, yada yada.)
- larubbio 13y agoAgreed. That and blank lines between the if blocks to visually separate the code blocks as well.