4 ms·
That's hilarious. I wonder why "long long" is 40 bits? And... A non-function-pointer is "16 or 23" bits? Nice. What's the proper scenario to use "long" instea
by palish 15y ago
That's hilarious. I wonder why "long long" is 40 bits?
And... A non-function-pointer is "16 or 23" bits? Nice.
What's the proper scenario to use "long" instead of "int"? I've never bothered to use it.
- cube13 15y ago>What's the proper scenario to use "long" instead of "int"? I've never bothered to use it. It was necessary with 16-bit processors, because ints were 16-bit shorts, and longs were 32-bits. With modern processors and OS', there isn't really a reason to use it. In fact, it's potentially dangerous if you're writing *nix code that's supposed to run on 64 or 32-bit systems. In that case, you don't want to use longs, because they're 32-bits on a 32-bit compile, but 64 on 64-bits on a 64-bit compiler. For Windows, int and long are interchangable 32-bit values, which is another reason to avoid using longs as much as possible when writing portable code.
- mansr 15y agoI wonder why "long long" is 40 bits? The immediate reason is that the ALU is 40 bits wide. The reason it has this particular size is probably a tradeoff between computational power vs silicon area and power consumption. A non-function-pointer is "16 or 23" bits? Near and far pointers, sort of.