[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <44F44072.4020506@bigpond.net.au>
Date: Tue, 29 Aug 2006 23:26:10 +1000
From: Peter Williams <pwil3058@...pond.net.au>
To: Jan Engelhardt <jengelh@...ux01.gwdg.de>
CC: Christoph Hellwig <hch@...radead.org>,
Nicholas Miell <nmiell@...cast.net>,
Richard Knutsson <ricknu-0@...dent.ltu.se>,
James.Bottomley@...elEye.com, linux-scsi@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: Conversion to generic boolean
Jan Engelhardt wrote:
>>>> That is error-prone. Not "==FALSE" but what happens if x is (for some
>>>> reason) not 1 and then "if (x==TRUE)".
>>> If you're using _Bool, that isn't possible. (Except at the boundaries
>>> where you have to validate untrusted data -- and the compiler makes that
>>> more difficult, because it "knows" that a _Bool can only be 0 or 1 and
>>> therefore your check to see if it's not 0 or 1 can "safely" be
>>> eliminated.)
>> gcc lets you happily assign any integer value to bool/_Bool, so unless
>
> But, it coerces the rvalue into 0 or 1, which may be a gain.
Actually, it's not coercion. It's the result of evaluating the value as
a boolean expression.
>
>> you write sparse support for actually checking things there's not the
>> slightest advantage in value range checking.
>
>
> Jan Engelhardt
--
Peter Williams pwil3058@...pond.net.au
"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists