Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Mar 2002 04:29:15 +0000
From:      Tony Finch <dot@dotat.at>
To:        Poul-Henning Kamp <phk@critter.freebsd.dk>
Cc:        Garance A Drosihn <drosih@rpi.edu>, Mike Meyer <mwm-dated-1015843484.1eabc5@mired.org>, hackers@FreeBSD.ORG
Subject:   Re: RFC: style(9) isn't explicit about booleans for testing.
Message-ID:  <20020307042915.D29816@chiark.greenend.org.uk>
In-Reply-To: <26424.1015440592@critter.freebsd.dk>

next in thread | previous in thread | raw e-mail | index | archive | help
Poul-Henning Kamp <phk@critter.freebsd.dk> wrote:
>
>Right, and since the integer is well defined,
>	if (!strcmp(a, b))
>is perfectly understandable so what is the problem ?

If that is ok, then why is

	p = malloc(sizeof(*p));
	if (!p)
		return ENOMEM;

not ok, given that is even more well-defined?

I am of the opinion that expressions in a conditional context (i.e.
argument of ! && || ?: if while) should be boolean-valued (i.e. either 0
or 1 corresponding to false or true). If they aren't then an appropriate
comparison should be done.

Tony.
-- 
f.a.n.finch <dot@dotat.at>
FAEROES SOUTHEAST ICELAND: EASTERLY, BECOMING CYCLONIC THEN WESTERLY, 4 OR 5.
SNOW OR SNOW SHOWERS. GOOD OCCASIONALLY POOR.

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?20020307042915.D29816>