[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
    On Thu, 16 Mar 2006, Jan Engelhardt wrote:
    > >> of course. but that it's not used in core code implies this opinion is
    > >> widely shared.
    > >
    > >[...] To me it is a simple consequence of there not
    > >being a boolean type in the kernel so you cannot use it in the core code.
    > typedef bool int;

    You mean typedef int bool...

    That (or its derivative) is what at least 69 places in the kernel do
    already. That is the whole point of discussion! The point is to unify it
    all into a kernel common place. I just suggested that using the compiler
    provided _Bool was better than using int.

    > And then happily use if(EXPR) and if(!EXPR) instead of if(EXPR == TRUE) or
    > if(EXPR == FALSE). :-)

    Obviously. No-one here is suggesting to use if (EXPR == TRUE) that is
    crazy. You would use if (EXPR) no matter what type you use. Technically
    only a boolean type should be used like that. The fact it works for an
    int is concidence because false = 0 and true = 1.

    The point is 1) when assigning, you assign x = FALSE; rather than x = 0;
    which means nothing (it could be a counter you are initializing, no way to
    tell) and 2) for return values from functions and parameters to functions
    so it is easier to understand the semantics of the function.

    Best regards,

    Anton Altaparmakov <aia21 at> (replace at with @)
    Unix Support, Computing Service, University of Cambridge, CB2 3QH, UK
    Linux NTFS maintainer / IRC: #ntfs on
    WWW: &
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to
    More majordomo info at
    Please read the FAQ at

     \ /
      Last update: 2006-03-16 23:38    [W:0.021 / U:1.804 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site