Re: 0xdeadbeef vs 0xdeadbeefL

From: Alexandre Oliva
Date: Wed Jul 07 2004 - 00:56:17 EST


On Jul 6, 2004, Ray Lee <ray-lk@xxxxxxxxxxxxx> wrote:

> Which means 0xdeadbeef is a perfectly valid literal for an unsigned int.

Assuming ints are 32-bits wide. They don't have to be. They could be
as narrow as 16 bits, in which case the constant will have type long
or unsigned long (because long must be at least 32 bits), or they
could be wider than 32 bits, in which case the constant will be signed
int instead of unsigned int. You might lose either way. It's
probably safer to make it explicitly UL, except perhaps in
machine-specific files where the width of types is well-known.

--
Alexandre Oliva http://www.ic.unicamp.br/~oliva/
Red Hat Compiler Engineer aoliva@{redhat.com, gcc.gnu.org}
Free Software Evangelist oliva@{lsd.ic.unicamp.br, gnu.org}
-
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/