[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1153354106.44bec97a1215b@portal.student.luth.se>
Date: Thu, 20 Jul 2006 02:08:26 +0200
From: ricknu-0@...dent.ltu.se
To: Peter Williams <pwil3058@...pond.net.au>
Cc: Alexey Dobriyan <adobriyan@...il.com>, linux-kernel@...r.kernel.org
Subject: Re: [RFC][PATCH] A generic boolean
Citerar Peter Williams <pwil3058@...pond.net.au>:
> ricknu-0@...dent.ltu.se wrote:
> > Citerar Alexey Dobriyan <adobriyan@...il.com>:
> >> Please, show compiler flag[s] to enable warning[s] from gcc about
> >>
> >> _Bool foo = 42;
> >>
> >> Until you do that the whole activity is moot.
> > On it...
>
> Would not the compiler treat 42 as a Boolean expression (as opposed to
> an integer expression) that evaluates to true and set foo accordingly.
> I.e. there's only a problem here if foo ends up with the value 42
> instead of the value true.
Yeah, that is true. As I said, the only way (I seen) is to cast the pointer from
the boolean variable to something else and change the value on that address. But
it would be neat if the compiler said something when inserting somthing else
then (or equal to) 0 and 1.
Right now it is happy with:
_Bool a = "Hello world";
Well, better go to bed while I still remember where it is.
Good night
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists