lkml.org 
[lkml]   [2002]   [Jan]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: RFC: booleans and the kernel
    Gábor Lénárt wrote:
    > Khmmm please enlighten me ...
    >
    > > if (X == true && ptr && *ptr > 1)
    >
    > Why? Simply use for example type 'char' as boolean value. Let's say
    > 0 means false and other value is true.
    >
    > So:
    >
    > if (x) printf("true");
    > or
    > if (!x) printf("false");
    >
    > Why do you want to overcomplicate?

    If the variable holds a boolean in the C language, fair enough but if
    it's being used as a range in a truth-value system of _another_
    language, i.e. it simply _represents_ a truth value, I would write it
    differently.

    If it were a theorem proving paper, the different kinds of variable
    would have a different font or colour :-)

    > x=a>b;
    > if (x) printf("A is greater than B");
    >
    > ONE thing which is best in C is the less strictly type rules eg you
    > can use 'char' to store eg c='A' or c=2.

    You seem to have missed the point. We _know_ the C language rules. I
    agree that non-strict typeing is quite useful, although C is in fact
    quite strict. Lisp has far less strict typing :-)

    > Hey guys, C was designed to write an OS it's not something other ...

    Perhaps, but it's pretty useful for something other.

    -- Jamie
    -
    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:0.045 / U:62.440 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site