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 [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]