刚刚看到一个博客上贴了这个,解决了我一直以来的疑问:int和long是不是一样的?答案是:不确定。
转载自:http://itnewsvendor.appspot.com/2379028-int_long_unsigned.html
数据类型名称 | 字节数 | 别名 | 取值范围 |
int | * | signed, signed int | 由操作系统决定,即与操作系统的"字长"有关 |
unsigned int | * | unsigned | 由操作系统决定,即与操作系统的"字长"有关 |
__int8 | 1 | char, signed char | –128 到 127 |
__int16 | 2 | short, short int, signed short int | –32,768 到 32,767 |
__int32 | 4 | long, long int, signed long int | –2,147,483,648 到 2,147,483,647 |
__int64 | 8 | long long, long long int, signed long long int | –9,223,372,036,854,775,808 到 9,223,372,036,854,775,807 |
bool | 1 | false 或 true | |
char | 1 | signed char, (__int8) | –128 到 127 |
unsigned char | 1 |
| 0 到 255 |
short | 2 | short int, signed short int, (__int16) | –32,768 到 32,767 |
unsigned short | 2 | unsigned short int | 0 到 65,535 |
long | 4 | long int, signed long int, (__int32) | –2,147,483,648 到 2,147,483,647 |
unsigned long | 4 | unsigned long int | 0 到 4,294,967,295 |
long long | 8 | long long int, signed long long int, (__int64) | –9,223,372,036,854,775,808 到 9,223,372,036,854,775,807 |
unsigned long long | 8 | unsigned long long int | 0 到 18,446,744,073,709,551,615 |
enum | * |
| 由操作系统决定,即与操作系统的"字长"有关 |
float | 4 | 无 | 3.4E +/- 38 (7 digits) |
double | 8 | 无 | 1.7E +/- 308 (15 digits) |
long double | * | 无 | 视平台而定,一般来说精度比double高 |
wchar_t | 2 | __wchar_t | 0 到 65,535 |