2011-08-18, 06:03 PM
Katforks Wrote:C++ has always made my head hurt but good lord. longs in C# at least were already 64bit [and are in the other languages i've worked with iirc, haven't had to pay attention to it until recently], so if they made long long int be 64 then what the hell is a normal int, 16?
I like the threading stuff and what they did to sizeof though. If I ever need to pick this up to complete my knowledge of the C family I'll feel a little better about learning it.
I still prefer java though ;-;
C and C++ are designed to be ultraportable, usable for any conceivable processor architecture. Most (all?) processors these days have 8-bit bytes (where a "byte" means the smallest addressable memory unit), but back in the days when C was created, this was not the case. There were processors with 7-bit bytes. The standard only specifies a minimum size for the integral types. The actual size is compiler/platform dependent. If you want a variable to be a specific size, you can #include <boost/cstdint.hpp> or <stdint.h> or <cstdint> and use int64_t or whatever.
Long long was already supported as an extension by most compilers. If memory serves, MSVC targeting x86 has short=16, int=32, long=32, long long=64.

