lkml.org 
[lkml]   [2006]   [Mar]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [patch 1/1] consolidate TRUE and FALSE
    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.

    > Why not use that instead of "int"?

    That'd be a separate patch ;)

    > Also <stdbool.h> contains:
    >
    > #define bool _Bool
    > #define true 1
    > #define false 0
    >
    > So we could take the bool rather than _Bool, too given _Bool looks
    > rather ugly...

    We have a couple of private bools and a couple of private 'true's and
    `false's so I guess it'd be a simple patch. I wonder if it would have any
    surprising side-effects.

    (I think using `bool' is a good thing - it makes the code more readable.
    It's a shame the compiler's handling of it is so useless).

    -
    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 11:49    [W:4.450 / U:0.032 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site