Windows和Linux的常用数据类型在32位和64位中需要注意到地方如下表格。
不同的数据类型所占到字节数Bytes。
数据类型 | windows32bit | windows64bit | Linux32bit | Linux64bit |
char | 1 | 1 | 1 | 1 |
wchar_t | 2 | 2 | 4 | 4 |
short | 2 | 2 | 2 | 2 |
int | 4 | 4 | 4 | 4 |
long | 4 | 4 | 4 | 8 |
long long | 8 | 8 | 8 | 8 |
float | 4 | 4 | 4 | 4 |
double | 8 | 8 | 8 | 8 |
long double | 8 | 8 | 12 | 16 |
pointer | 4 | 8 | 4 | 8 |