“No-else-after-return” considered harmful
Posted in C, Correctness, Cplusplus, Programming on August 31st, 2009 19 Comments »
(Update below)
At the time of writing this, the Mozilla Coding Style guidelines have this recommendation under “General C/C++ Practices”:
Don’t put an else right after a return. Delete the else, it’s unnecessary and increases indentation level.
I can appreciate this in some circumstances, such as when checking for an error case early in a long function:
void f()
{
[...]