Re: Prohibited attachment type (was 0xdeadbeef)

From: tom st denis
Date: Wed Jul 07 2004 - 06:49:38 EST


--- "Richard B. Johnson" <root@xxxxxxxxxxxxxxxxxx> wrote:
> Tom is correct. A literal constant defaults to 'int'.

I did a bit more messing around with GCC and it seems in

int x = 4;
if (x == 0xDEADBEEF) { ... }

It will warn that 0xDEADBEEF is unsigned (which it isn't). Either
there is an obscure clause in the C standard [I personally don't have a
copy of C99 nor do I plan on reading it for this] or GCC cause an
incorrect diagnostic [which isn't in violation of the standards...]

Really GCC should just warn that 0xDEADBEEF is not a valid int constant
[for portability sake...]. It's simple, any constant > 16-bits should
have a UL/L or ULL/LL suffix.

Tom




__________________________________
Do you Yahoo!?
New and Improved Yahoo! Mail - 100MB free storage!
http://promotions.yahoo.com/new_mail
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/