lkml.org 
[lkml]   [2006]   [Aug]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: Conversion to generic boolean
From
Date
On Mon, 2006-08-28 at 14:17 +0200, Richard Knutsson wrote:
> Jan Engelhardt wrote:
>
> >>>Just would like to ask if you want patches for:
> >>>
> >>>
> >>Total NACK to any of this boolean ididocy. I very much hope you didn't
> >>get the impression you actually have a chance to get this merged.
> >>
> >>
> >>
> >>>* (Most importent, may introduce bugs if left alone)
> >>>Fixing boolean checking, ex:
> >>>if (bool == FALSE)
> >>>to
> >>>if (!bool)
> >>>
> >>>
> >>this one of course makes sense, but please do it without introducing
> >>any boolean type. Getting rid of all the TRUE/FALSE defines and converting
> >>all scsi drivers to classic C integer as boolean semantics would be
> >>very welcome janitorial work.
> >>
> >>
> >
> >I don't get it. You object to the 'idiocy'
> >(http://lkml.org/lkml/2006/7/27/281), but find the x==FALSE -> !x
> >a good thing?
> >
> >
> 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.)

--
Nicholas Miell <nmiell@comcast.net>

-
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-28 21:19    [W:0.117 / U:0.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site