Luke Mewburn <lukem%netbsd.org@localhost> wrote:
I propose that the NetBSD C style guide in to /usr/share/misc/style
is reworded to more explicitly permit braces around single statements,
instead of the current discourgement.
IMHO, permitting braces to be consistently used:
- Adds to clarity of intent.
- Aids code review.
- Avoids gotofail: https://en.wikipedia.org/wiki/Unreachable_code#goto_fail_bug
Yes, please.
My primary reason to prefer them is minimizing diffs when you do need
to add another statement. If the OTBS opening brace is already there
then you don't need to spend any mental effort on parsing:
- if (complex condition full of alphabet soup and punctuation)
+ if (complex condition full of alphabet suop and punctuation) {
to check whether the condition was changed or if it's just the brace.