Subject: Re: a new KNF (and some comments)
To: None <tech-misc@netbsd.org>
From: Christos Zoulas <christos@zoulas.com>
List: tech-misc
Date: 01/21/2000 06:07:03
In article <200001210126.RAA06568@lestat.nas.nasa.gov>,
Jason Thorpe <thorpej@nas.nasa.gov> wrote:
> > 	/*
> > 	 * Space after keywords (while, for, return, switch).  No braces are
> > 	 * used for control statements with zero or only a single statement.
> > 	 *
> > 	 * Forever loops are done with for's, not while's.
> > 	 */
> > 	for (p = buf; *p != '\0'; ++p);
>
>I've found bugs related to extra ;'s at the end of statements like this.
>How about:
>
>	for (p = buf; *p != '\0'; ++p)
>		/* nothing */ ;
>
>?  For clarity.

Well, I prefer:
	for (p = buf; *p != '\0'; ++p)
		continue;

It is a language feature, does not cost a thing and it conveys the intent.

christos