cvs commit: src/sys/dev/cfe cfe_console.c

John Baldwin jhb at freebsd.org
Mon Sep 29 15:38:45 UTC 2008


On Saturday 27 September 2008 11:54:06 pm Colin Percival wrote:
> Warner Losh wrote:
> >   Change while (cond)\n\t\t; to while (cond)\n\t\tcontinue; since the
> >   former more explicitly tells the compiler that you want an empty loop.
> >   There are some lint programs that use this hint to avoid generating
> >   warnings.
> 
> In style(9) the example
> 	for (p = buf; *p != '\0'; ++p)
> 		;	/* nothing */
> is given, but I really like the explicit continue; enough so that I'm
> wondering if the example in style(9) should be changed to
> 	for (p = buf; *p != '\0'; ++p)
> 		continue;
> to encourage people to write that way (I hope I'm not the only person
> who simply never thought of adding the explicit continue?).
> 
> Realizing that questions of style tend to provoke huge debates: Please
> send me your opinions off-list, and I'll only make this change if the
> emails I get are at least 75% in favour.

Assuming lint doesn't have special magic for '/* nothing */' (it does for
/* NOTREACHED */ and /* FALLTHROUGH */ IIRC), then I think we should update 
style(9) for the 'continue;' style that existing tools parse better.

-- 
John Baldwin


More information about the cvs-src mailing list