I’m creating a game engine and It’s going to have support for Microsoft Windows X86 and X64 editions. When I’m creating the custom typedefs, do I have to specify “typedef unsigned long long” if the version is X86 and “typedef unsigned long” when the version is X64?
Share
The long long type is 64 bits on all compilers that support it. (The C/C++ standards say it has to be at least 64 bits; I don’t think there are any systems yet that support larger types.) If you just want a 64 bit integer typedef, you can use long long without any worries.
The C99 and C++11 standards provide a new header, <stdint.h> or <cstdint>, that already has a set of fixed size typedefs, so you can just use uint64_t. Visual Studio 2010 supports this but I don’t think VS2008 does.
The C and C++ standards only specify minimum sizes for the standard integer types: