5 ms·
I hoped to see a paragraph on hexadecimal notation (eg: 0xbeef), alas we'll have to settle for Stack Overflow's [1] wisdom on this: > Short story: the 0 tells
by franky47 4y ago
I hoped to see a paragraph on hexadecimal notation (eg: 0xbeef), alas we'll have to settle for Stack Overflow's [1] wisdom on this:
> Short story: the 0 tells the parser it's dealing with a constant (and not an identifier/reserved word). Something is still needed to specify the number base: the x is an arbitrary choice.
[1] https://stackoverflow.com/questions/2670639/why-are-hexadecimal-numbers-prefixed-with-0x#4581351 https://stackoverflow.com/questions/2670639/why-are-hexadeci...
- euroderf 4y agoLest we forget our lore: 0xDEADBEEF and (based on a true story!) 0xCAFEBABE.
- gjm11 4y agoThe answer gives no evidence that the "x" is truly arbitrary and I am not inclined to believe it. "x" is one of the letters of "hexadecimal" and the letter-name sounds very much like "hex". Are we supposed to believe that Thompson or Kernighan or whoever it was picked a random letter of the alphabet and it just happened to be one of the two letters ("h" would be the other) with an obvious mnemonic connection to "hex"/"hexadecimal"?
- wink 4y ago*Steak Overflow