Subject: Re: a new KNF (and some comments)
To: None <lukem@cs.rmit.edu.au, tech-misc@netbsd.org, tech-kern@netbsd.org>
From: Guenther Grau <Guenther.Grau@de.bosch.com>
List: tech-kern
Date: 01/21/2000 02:10:19
Hi,
just as another datapoint/opinion.
Luke Mewburn wrote:
> * Update it to ANSI C (`c89').
I fully support this.
> * We are not considering changing our indenting style or indent level.
> This is a contentious issue and a lot of developers object to the
> alternate proposals made (no matter how many reports on code
> readability from academics you can drag up).
> We have ~ 25,500 files with ~ 8,200,000 lines of code, and we're not
> reformatting it.
Although I'd personally prefer a different indentation style, I'd be
happy to compromise on this issue.
> /*
> * Space after keywords (while, for, return, switch). No braces are
> * used for control statements with zero or only a single statement.
[...]
> * Don't add braces that aren't necessary.
[...]
> * Unary operators don't require spaces, binary operators do. Don't
> * use parenthesis unless they're required for precedence, or the
> * statement is really confusing without them, such as:
I don't quite agree with this and I'd ask to rephrase this.
I'd rather not discourage people from using parenthesis.
I'd prefer something like: Don't excessively use parenthesis,
but when in doubt, use them. It makes code much easier to
comprehend even for those of us who don't know the operator
preference table by heart when somebody wakes you up at
5 o'clock in the morning :-).
Other than that, I'll completely agree with your proposal!!!
Well done.
Guenther