Date: Wed, 6 Mar 2002 04:30:32 -0600 From: "Mike Meyer" <mwm-dated-1015842633.bc6005@mired.org> To: obrien@freebsd.org Cc: Mike Meyer <mwm-dated-1015831171.a21ab0@mired.org>, Giorgos Keramidas <keramida@freebsd.org>, hackers@freebsd.org Subject: Re: RFC: style(9) isn't explicit about booleans for testing. Message-ID: <15493.61384.557931.883967@guru.mired.org> In-Reply-To: <20020306005225.A6921@dragon.nuxi.com> References: <20020305201350.GC4820@hades.hell.gr> <20020305155850.A38095@dragon.nuxi.com> <20020306000806.GC6839@hades.hell.gr> <20020305164054.B38095@dragon.nuxi.com> <15493.49923.458997.98416@guru.mired.org> <20020306005225.A6921@dragon.nuxi.com>
next in thread | previous in thread | raw e-mail | index | archive | help
David O'Brien <obrien@freebsd.org> types:
> On Wed, Mar 06, 2002 at 01:19:31AM -0600, Mike Meyer wrote:
> > David O'Brien <obrien@freebsd.org> types:
> > As the original author of the PR, I'll point out that this chagne does
> > *not* add rules. It clarifies the wording of a rule that's already
> > there. If the rule is wrong, it should be removed. The reason I didn't
> > post if for wider review was because it wasn't changing any rules. My
> > thanks to Giorgos for moving this PR towards closure.
>
> I don't think it is clarifying a rule. I think it is in fact adding a
> rule. You are extrapolating too much I think. All the rule is trying
> to prevent is "if (!strcmp(a,b))" which when read is extremely wrong of
> that is actually happening.
Ok, I was attempting to clarify a rule, but misinterpreted. Which just
reinforces the need for clarifing it.
Being an old lisp hand, I'm used to functions that return a value or
nil to indicate an error of some kind, and programs that just check
the value are SOP.
I'll grant that the change Paul suggested makes it clear - the
programmer knows when the function is returning an int or not. But
it's not clear that it achieves his intent. is
char *p;
if (p = somerandomfunction(with, args)) {
}
really less readable than:
char *p;
if ((p = somerandomfunction(with, args)) != NULL) {
}
<mike
--
Mike Meyer <mwm@mired.org> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?15493.61384.557931.883967>
