Reputation: 721
On 64-bit architectures, long int
, according to gcc is at least an int64_t
. On 32-bit, long int
is at least int32_t
. With Microsoft compilers, long
is always an int32_t
, regardless of 32/64-bit. Is there any way to:
Upvotes: 6
Views: 23966
Reputation: 213160
Don't do this - use standard types such as int32_t
, uint32_t
, int64_t
, uint64_t
, etc from <stdint.h>
rather than trying to make assumptions about naked types such as long int
or trying to bend the compiler to your will.
Note: The 64-bit model for any given platform (e.g. LP64 for most *nix platforms, Mac OS X, etc) is a given, so even if you could convince the compiler to use a different 64-bit model you would probably break any calls to system code, libraries, etc.
Upvotes: 19
Reputation: 62333
This is why its generally much easier to use a set of typedefs that are defined per platform. It will really save you a lot of hassle when compiling on random-platform-with-random-compiler-47.4
Upvotes: 0