tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: style change: explicitly permit braces for single statements

At Sun, 12 Jul 2020 10:01:36 +1000, Luke Mewburn <> 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:

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 <>

Kelowna, BC     +1 250 762-7675           RoboHack <>
Planix, Inc. <>     Avoncote Farms <>

Attachment: pgpzoZfmGWwxv.pgp
Description: OpenPGP Digital Signature

Home | Main Index | Thread Index | Old Index