Subject: Re: KNF and braces (was: Re: EGCS 1.1 UPDATE rev. 4)
To: None <current-users@netbsd.org>
From: Danny Thomas <D.Thomas@vthrc.uq.edu.au>
List: current-users
Date: 08/19/1998 09:04:07
Ted Lemon <mellon@hoffman.vix.com> quoth:
>> >   (4) KNF will be changed so that fully-braced blocks are encouraged.
>>
>> I like this best of all.
>
>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.

I've always been amused by the various styles of braces people advocate.

I find braces distracting, particularly when they're on lines by themselves
and personally put all of them at the end of lines containing real code,
way off to the right. Indentation is how my eye perceives the code, though
I guess others get used to 'their' styles.

The conventional brace styles consume too much vertical space but more
significantly break up the visual grouping of program blocks, much in the
way styles-sheet-less web browsers do. Or using blank lines to separate
paragraphs in documents.

Braces contribute a tension between how the compiler sees the code vs how
the human lays it out. The common styles are a way of specifying
indentation and brace placement, but why do you need both? I used to use a
tool which verified that indentation matched what the the braces said, or
could add the braces when I chose not to use any so the compiler would see
things 'my way'. It's simple enough to get such a tool to add braces in
whatever style you want.

Then again I was interested in Occam at the time 8-)


cheers,
Danny Thomas