4 ms·
Congratulations! You've constructed a strawman argument. Sure, if somebody used a brace formatting rule like the one you've given, which is explicitly done in
by talideon 13y ago
Congratulations! You've constructed a strawman argument.
Sure, if somebody used a brace formatting rule like the one you've given, which is explicitly done in a way that wouldn't have avoided the issue, it still would've happened. However if somebody was to consistently place the statements on a line of their own as just about any real world brace formatting rule would, the issue would be avoided. Thus:
if (error_of_first_kind) {
goto fail;
}
/* ... */
if (error_of_fifth_kind) {
goto fail;
goto fail;
}
if (error_of_sixth_kind) {
goto fail;
}
The_truly_important_code_handling_non_erroneous_case
Is safe, as would be:
if (error)
{
goto fail;
}
if (error)
{
goto fail;
}
Or:
if (error)
{
goto fail;
}
The idea behind always using braces is to _avoid insertion errors_ when editing. If you need to jiggle the braces around to go from one statement more than one, you're doing it wrong.