Wrap up question regarding use of bitfields in structures.
John Love-Jensen
eljay@adobe.com
Mon Oct 22 15:11:00 GMT 2007
Hi Akshay,
> Could anyone pls explain to me this behavior ?
I think it is best explained as GIGO.
Or as per ISO 14882 4.7.2:
If the destination type is unsigned, the resulting value is the least
unsigned integer congruent to the source integer (modulo 2^n where n is the
number of bits used to represent the unsigned type).
You can see the same kind of behavior by doing:
unsigned char c = 0x123456;
HTH,
--Eljay
More information about the Gcc-help
mailing list