Subject: Re: Parentheses and KNF
To: None <current-users@netbsd.org>
From: Wolfgang Solfrank <ws@tools.de>
List: current-users
Date: 08/20/1998 14:45:58
> Sounds good, except that there shouldn't be any spaces between similar
> parentheses - )), not ) ).

While we are at this, I'd like to have the suggestion for continuation lines
changed.  Currently continuation lines are supposed to be indented by four
spaces independent of semantics.  In addition, while not explicitly stated,
it is implied that the operator gets placed at the end of the previous line.
I like to express the semantics more with the indentation, i.e. instead of:

				dirbuf.d_fileno = cntobn(pmp,
				    pmp->pm_rootdirblk) * dirsperblk;

I like this more:

				dirbuf.d_fileno = cntobn(pmp,
							 pmp->pm_rootdirblk)
						  * dirsperblk;

(This is an actual code snippet from msdosfs_vnops.c.)

This is, place the operator at the start of the continuation line (except
for the comma separator); if lines are broken at one point, break it at all
lower binding operators, too; and indent continuation lines to the point where
the first operand at the same binding level in the previous line is.

IMHO this makes those expressions much easier to parse.  (And yes, I know
that this wastes some of the valuable screen real estate.)

(Now searching for my asbestos suit...)

Ciao,
Wolfgang
-- 
ws@TooLs.DE     (Wolfgang Solfrank, TooLs GmbH) 	+49-228-985800