Readable code (Was: Re: [H-GEN] Which is better?)

Anthony Towns aj at azure.humbug.org.au
Thu Apr 29 03:48:30 EDT 2004


On Thu, Apr 29, 2004 at 02:00:19PM +1000, Greg Black wrote:
> Speaking of indent, does anybody know of an incantation to
> either BSD or GNU indent to do K&R style but to leave the
> following as is, rather than moving the lone semi-colon up to
> the "for" line:
>     for (p = buf; isspace(*p); ++p)
>         ;
> K&R style would leave it as is, but both versions of indent seem
> to want to move it.

Personally, I'd make it "NULL;" or more likely rewrite it as:

	p = buf;
	while (isspace(*p)) 
		p++;

When you're looking at a loop, you should be able to spot the stuff
that takes the most effort by looking at the body, rather than the
conditions, IMO.

(Hey, you said it was okay to avoid the question being asked, right?)

Cheers,
a "loser/idiot" j

-- 
Anthony Towns <aj at humbug.org.au> <http://azure.humbug.org.au/~aj/>
Don't assume I speak for anyone but myself. GPG signed mail preferred.

Protect Open Source in Australia from over-reaching changes to IP law
http://www.petitiononline.com/auftaip/ & http://www.linux.org.au/fta/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 307 bytes
Desc: Digital signature
URL: <http://lists.humbug.org.au/pipermail/general/attachments/20040429/a1a5d8c6/attachment.sig>


More information about the General mailing list