lkml.org 
[lkml]   [2006]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: [patch 1/1] consolidate TRUE and FALSE
From
Date
On Thu, 2006-03-16 at 02:42 -0800, Andrew Morton wrote:
> Anton Altaparmakov <aia21@cam.ac.uk> wrote:
> >
> > > Various places are doing things like
> > >
> > > typedef {
> > > FALSE,
> > > TRUE
> > > } my_fave_name_for_a_bool;
> > >
> > > These are converted to
> > >
> > > typedef int my_fave_name_for_a_bool;
> >
> > Given that the kernel now requires gcc 3.2 or later, that already includes
> > a native boolean type (_Bool)?
>
> It does?
>
> Is it any good?
>
> bix:/home/akpm> cat t.c
> void foo()
> {
> _Bool b = 1;
>
> b += 2;
> }
> bix:/home/akpm> gcc -O -Wall -c t.c
> bix:/home/akpm>
>
> Sigh.
>

If you were to read the value of b after "b += 2", you'd find that b is
still 1.

Also note that _Bool is a byte, so anything that exposed its own custom
boolean type to userspace needs to be carefully updated.

--
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-03-16 20:57    [W:0.067 / U:1.396 seconds]
©2003-2018 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site