Re: bitfield signedness

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 04/29/2011 09:37 PM, Kalle Olavi Niemitalo wrote:
Wouter Vermaelen<wouter.vermaelen@xxxxxxxxxx>  writes:

In s.a<  -1, the<  operator performs (C99 6.5.8p3) the usual
arithmetic conversions, which include (6.3.1.8p1) the integer
promotions (6.3.1.1p2).  In unsigned a : 27, the width of the
bit-field is part of the type (6.7.2.1p9).  If the int type is
32-bit as usual, then all possible values of s.a fit in int, and
the result of the integer promotions is an int, even though the
bit-field was declared as unsigned.

I don't know if C89 had different rules for this.

An extended C++ variant of your test program:
>
> ....

Thanks for your detailed answer. Also thanks for your test
program, that typeid() trick is very useful.

Wouter


[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux