Re: Conversion to generic boolean

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



>> > 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.

>you write sparse support for actually checking things there's not the
>slightest advantage in value range checking.


Jan Engelhardt
-- 
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux