Re: 0xdeadbeef vs 0xdeadbeefL

From: viro
Date: Tue Jul 06 2004 - 22:01:31 EST


On Tue, Jul 06, 2004 at 05:06:12PM -0700, tom st denis wrote:
> --- David Eger <eger@xxxxxxxxxxxxx> wrote:
> > Is there a reason to add the 'L' to such a 32-bit constant like this?
> > There doesn't seem a great rhyme to it in the headers...
>
> IIRC it should have the L [probably UL instead] since numerical
> constants are of type ``int'' by default.
>
> Normally this isn't a problem since int == long on most platforms that
> run Linux. However, by the standard 0xdeadbeef is not a valid unsigned
> long constant.

... and that would be your F for C101. Suggested remedial reading before
you take the test again: any textbook on C, section describing integer
constants; alternatively, you can look it up in any revision of C standard.
Pay attention to difference in the set of acceptable types for decimal
and heaxdecimal constants.
-
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/