Subject: Re: KNF and braces (was: Re: EGCS 1.1 UPDATE rev. 4)
To: None <current-users@netbsd.org>
From: Jay Maynard <jmaynard@phoenix.net>
List: current-users
Date: 08/18/1998 15:10:29
On Tue, Aug 18, 1998 at 12:26:05PM -0700, Ted Lemon wrote:
> > >   (4) KNF will be changed so that fully-braced blocks are encouraged.

This has my vote.

> Yicch.   Plese, no.   We're all adults here.   We can figure out
> whether or not we need to enclose a statement in braces when we add a
> printf.   Extraneous braces are inelegant.

Broken code is less elegant.

To me, software coding standards encourage 2 things: 1) Readability, and 2)
reliability. "Extraneous" braces aid both, as they 1) make the programmer's
intent clearer and 2) reduce the likelihood of error with future code
maintenance. It's a tiny cost and a large benefit, and I was surprised to
see that KNF outlawed/discouraged it.

How do you feel about "extraneous" parentheses to force or clarify
expression evaluation order? I parenthesize obsessively, for exactly the
reasons that I {} everything - the two reasons above.