lkml.org 
[lkml]   [2006]   [Aug]   [29]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Conversion to generic boolean
On Mon, Aug 28, 2006 at 12:15:40PM -0700, Nicholas Miell 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
you write sparse support for actually checking things there's not the
slightest advantage in value range checking.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2006-08-29 13:45    [W:0.101 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site