[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Pine.LNX.4.64.0702081643280.30166@chino.kir.corp.google.com>
Date: Thu, 8 Feb 2007 16:59:41 -0800 (PST)
From: David Rientjes <rientjes@...gle.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
cc: Jan Engelhardt <jengelh@...ux01.gwdg.de>,
Jeff Garzik <jeff@...zik.org>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andrew Morton <akpm@...ux-foundation.org>
Subject: Re: somebody dropped a (warning) bomb
On Thu, 8 Feb 2007, Linus Torvalds wrote:
> No it's not.
>
> You just don't understand the C language.
>
> And if you don't understand the C language, you can't say "that's what the
> int says". It says no such thing.
>
> The C language clearly says that bitfields have implementation-defined
> types. So when you see
>
> struct dummy {
> int flag:1;
> } a_variable;
>
> if you don't read that as "oh, the sign of 'flag' is implementation-
> defined", then you simply aren't reading it right.
>
Maybe you should read my first post, we're talking about gcc's behavior
here, not the C standard. My criticism was that any compiler that makes
a_variable.flag unsigned is brain-dead and I was arguing in favor of gcc
treating plain int bitfields as signed ints (6.7.2, 6.7.2.1). This has
_nothing_ to do with the fact that the standard leaves it implementation
defined.
Naturally you should define it's signness explicitly in your code since it
is implementation defined. That's not the point.
Just because a compiler CAN consider a_variable.flag as unsigned doesn't
mean it makes sense. It makes no sense, and thus is brain-dead.
-
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