Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 21 Feb 2001 22:29:09 -0500
From:      Brian Dean <bsd@bsdhome.com>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Ben Smithurst <csxbcs@comp.leeds.ac.uk>, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/share/man/man9 style.9
Message-ID:  <20010221222909.A18715@vger.bsdhome.com>
In-Reply-To: <3555.982787149@critter>; from phk@critter.freebsd.dk on Wed, Feb 21, 2001 at 09:25:49PM %2B0100
References:  <20010221201615.A25231@comp.leeds.ac.uk> <3555.982787149@critter>

next in thread | previous in thread | raw e-mail | index | archive | help
On Wed, Feb 21, 2001 at 09:25:49PM +0100, Poul-Henning Kamp wrote:

> >> Better, and more readable:
> >> 
> >> 	error = function(a1, a2);
> >> 	if (error != 0)
> >
> >Well that's a matter of opinion, but I suppose it's easily changed. :-)
> >I figured there's enough use of 'if ((var = func()) != 0)' in FreeBSD
> >that everyone knows exactly what it does and yours isn't really any more
> >readable.  But it can easily be changed if people generally agree with
> >you.
> 
> The above form is generally more grep(1) and sed(1)'able

Not to mention easier to follow while stepping through with a
debugger, IMO.  It allows you to check the value, side affects, etc.,
before entering the conditional.

-Brian

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20010221222909.A18715>