It's been a minute since I've blogged, and I have something I want to rant about because I just don't get it. This is probably the result of design by commitee, but why the hell is C/C++'s int type four bytes on 64 bit machines, while long is eight? To me it makes more sense for the long type to be four bytes and let int get bumped up to eight.
C/C++'s integer types come in a spectrum in increasing size:
- char
- short
- long
- long long
And don't forget int.
That's all of the integer types, minus unsigned, that C/C++ has. Looking at that list it would make sense to make their sizes be consistent on all platforms so char is one byte, short two, long four, long long at eight, and have int roam around a bit.
Is this what we get on today's 64 bit platforms? No! int gets stuck at four bytes, and long gets bumped up to eight! Who the hell was to busy smoking the crack at the commitee meetings and didn't notice long long was already at eight?
I know, I know. It was a long spec, and the crack ran out. But it makes more sense to me anyway to let int roam about in its byte size leaving the oddly named integers like short and long stuck in their place.


