Comment by mansr
15 years ago
The Texas Instruments C55x DSP has 16-bit bytes. See the compiler documentation at http://www.ti.com/litv/pdf/spru281f section 5.3 if you do not believe me. This DSP has more unusual properties:
type size (bits)
------------------------------
char 16
short 16
int 16
long 32
long long 40
float 32
double 32
pointer (data) 16 or 23
pointer (function) 24
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.
>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.
I 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.