lkml.org 
[lkml]   [2007]   [Feb]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: 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@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: 2007-02-09 02:05    [W:0.087 / U:2.144 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site