Subject: Re: proposed new KNF [was Re: Time to update KNF?]
To: None <tech-kern@netbsd.org>
From: enami tsugutomo <enami@sm.sony.co.jp>
List: tech-kern
Date: 01/19/2000 11:52:17
Luke Mewburn <lukem@cs.rmit.edu.au> writes:

>  * Attempt to line-up the entries, using appropriate tabs and spaces.
>  *
		:
>  */
> struct foo {
> 	struct	foo	*next;		/* List of active foo */
> 	struct	mumble	 amumble;	/* Comment for mumble */
> 	int		 bar;
> };

I think this (and other line-ups like this) introduces unnecessary
stylistic constraint rather than readability.  If I want to add a
member of type `struct a_bit_longer', how should I indent this
structure?

Probably, there is three ways:
* keep to line-up by re-indenting other lines.
* keep to line-up by folding after type name of newly added line.
* give up to line-up newly added line.

But, rather, I just prefer writing this way:

struct foo {
	struct foo *next;		/* List of active foo */
	struct mumble amumble;		/* Comment for mumble */
	struct a_bit_longer baz;	/* Comment for baz */
	int bar;
};

Also, if I want to add a member of type `struct foo **' (or suppose
`struct mumble **' if *next is indented using seven spaces rather than
tab), all other members need to be shifted by one space.

> 	 * Don't use '!' for tests unless it's a boolean. E.g. use
> 	 * "if (*p == '\0')", not "if (!*p)".
>  	 *
  ^
You might want to delete this space before tab also.

enami.