On Tue, 26 Apr 2005, Bruce Lilly wrote:
> Demonstration code:
> --------------------------
> #define AAA 0x1U
> #define BBB 0x2U
>
> struct foo {
> unsigned int bar:8;
> };
>
> struct foo foos[] = {
> { ~(AAA) },
> { ~(BBB) },
> { ~(AAA|BBB) },
> { ~(AAA&BBB) }
> };
> --------------------------
>
> compiling with gcc 3.x produced no warnings, as expected (no problems as
> all values fit easily within the defined structure's bit field).
I don't see why you think the warnings are spurious. ~(AAA), for example,
is 4294967294, which being greater than 255 certainly does not fit within
the type unsigned:8. Previous GCC versions had a long-known bug whereby
they did not diagnose this; that bug has been fixed in GCC 4.
--
Joseph S. Myers http://www.srcf.ucam.org/~jsm28/gcc/
[EMAIL PROTECTED] (personal mail)
[EMAIL PROTECTED] (CodeSourcery mail)
[EMAIL PROTECTED] (Bugzilla assignments and CCs)