lkml.org 
[lkml]   [2004]   [Jul]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
SubjectRe: 0xdeadbeef vs 0xdeadbeefL
From
Date
tom st denis quoted David Eger saying:

>> 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.
> [...]
> However, by the standard 0xdeadbeef is not a valid unsigned
> long constant.

I think you have a different standard than I do [1]. According to K&R,
2nd ed, section A2.5.1 (Integer Constants):

The type of an integer depends on its form, value and suffix.
[...] If it is unsuffixed octal or hexadecimal, it has the first
possible of these types ["in which its value can be represented"
-- from omitted]: int, unsigned int, long int, unsigned long
int.

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

Ray

[1] "The great thing about standards is that there are so many
of them to choose from." Wish I could remember who said
that.


-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:04    [W:0.109 / U:0.308 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site