lkml.org 
[lkml]   [2002]   [Jan]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: RFC: booleans and the kernel
    Oliver Xymoron wrote:
    > On Thu, 24 Jan 2002, Jeff Garzik wrote:
    > > Where variables are truly boolean use of a bool type makes the
    > > intentions of the code more clear. And it also gives the compiler a
    > > slightly better chance to optimize code [I suspect].
    >
    > Unlikely. The compiler can already figure this sort of thing out from
    > context.

    X, true, and false are of type int.
    If one tests X==false and then later on tests X==true, how does the
    compiler know the entire domain has been tested? With a boolean, it
    would. Or a switch statement... if both true and false are covered,
    there is no need for a 'default'. Similar arguments apply for
    enumerated types.

    --
    Jeff Garzik | "I went through my candy like hot oatmeal
    Building 1024 | through an internally-buttered weasel."
    MandrakeSoft | - goats.com
    -
    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: 2005-03-22 13:15    [W:5.387 / U:0.080 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site