[llvm-dev] Codifying our Brace rules-
David Greene via llvm-dev
llvm-dev at lists.llvm.org
Mon Jun 15 14:35:23 PDT 2020
Matt Arsenault via llvm-dev <llvm-dev at lists.llvm.org> writes:
> I think braces should be added in all contexts, and the more contexts
> the better. It eliminates any inconsistency or attempt to contextually
> interpret rules. It also reduces merge conflicts, since something
> eventually something will probably be added inside any control flow
> statement. I’ve suffered through many painful merges trying to find
> where the braces went wrong, usually due to switch statements. The
> sometimes-braces-sometimes-not combined with the lack of indentation
> for switch cases leads to way more time figuring out braces than
> should be necessary.
+1. In addition, the lack of braces can lead to subtle bugs if one adds
a line to an existing single-line conditional statement. Best to be
safe and always use braces.
-David
More information about the llvm-dev
mailing list