At Sun, 12 Jul 2020 10:01:36 +1000, Luke Mewburn <[email protected]> wrote: Subject: style change: explicitly permit braces for single statements > > 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
Well, if you s/permit/require/g, I strongly concur (with possibly one
tiny exception allowed in rare cases -- when there's no newline).
Personally I don't think there's any good excuse for not always putting
braces around all single-statement blocks. The only bad execuse is that
the language doesn't strictly require them. People are lazy, I get that
(I am too), but in my opinion C is just not really safe without them.
--
Greg A. Woods <[email protected]>
Kelowna, BC +1 250 762-7675 RoboHack <[email protected]>
Planix, Inc. <[email protected]> Avoncote Farms <[email protected]>
pgplEU3KR6NQt.pgp
Description: OpenPGP Digital Signature
