Messages in this thread | | | Subject | Re: 0xdeadbeef vs 0xdeadbeefL | From | Ray Lee <> | Date | Tue, 06 Jul 2004 19:05:01 -0700 |
| |
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/
| |