There is no point to use else
after return
.
LLVM Coding Standards says the same:
...do not use
'else'
or'else if'
after something that interrupts control flow — likereturn
,break
,continue
,goto
,etc
. For example, this is bad:
case 'J': {
if (Signed) {
Type = Context.getsigjmp_bufType();
if (Type.isNull()) {
Error = ASTContext::GE_Missing_sigjmp_buf;
return QualType();
} else {
break;
}
} else {
Type = Context.getjmp_bufType();
if (Type.isNull()) {
Error = ASTContext::GE_Missing_jmp_buf;
return QualType();
} else {
break;
}
}
}
...The idea is to reduce indentation and the amount of code you have to keep track of when reading the code.