It's depend on arch, compiler etc.
MingW and MSVC uses 4 bytes (32bits) for int and long (AFAIK for 32 and 64 bit compilation mode).
You can see how it's defined in limits.h.
i.e.: mingw limits.h
/*
* Maximum and minimum values for ints.
*/
#define INT_MAX 2147483647
#define INT_MIN (-INT_MAX-1)
#define UINT_MAX 0xffffffff
/*
* Maximum and minimum values for shorts.
*/
#define SHRT_MAX 32767
#define SHRT_MIN (-SHRT_MAX-1)
#define USHRT_MAX 0xffff
/*
* Maximum and minimum values for longs and unsigned longs.
*
* TODO: This is not correct for Alphas, which have 64 bit longs.
*/
#define LONG_MAX 2147483647L
#define LONG_MIN (-LONG_MAX-1)
#define ULONG_MAX 0xffffffffUL
/*
* Maximum and minimum values for ints.
*/
#define INT_MAX 2147483647
#define INT_MIN (-INT_MAX-1)
#define UINT_MAX 0xffffffff
/*
* Maximum and minimum values for shorts.
*/
#define SHRT_MAX 32767
#define SHRT_MIN (-SHRT_MAX-1)
#define USHRT_MAX 0xffff
/*
* Maximum and minimum values for longs and unsigned longs.
*
* TODO: This is not correct for Alphas, which have 64 bit longs.
*/
#define LONG_MAX 2147483647L
#define LONG_MIN (-LONG_MAX-1)
#define ULONG_MAX 0xffffffffUL
To copy to clipboard, switch view to plain text mode
On the cplusplus.com stated minimum ranges for particular data types, let's say guidelines, are from C99 specification. I don't know if C11 change this. In short those are minimum.maximum sizes for all platform's that int should have (i.e. 2 bytes, 16bis or 4 bytes 32 bits).
One can say that all modern platform like Windows, Linux, MaCOSX use int as 32 bits (there are different types for 64bit int). According to this: http://www.viva64.com/en/a/0030/ even for 64bit CPU's. Of course it's not all true, You can see that in limits.h for Alphas.
Bookmarks