x32 x64平台下C/C++数据类型占字节比较
以下数据类型在Windows7 x32 SP1 和 Windows10 x64下统计。
Windows7 x32 SP1 使用VC6++
Windows10 x64 下使用Visual Studio2019(x64版本)
Linux平台(Ubuntu)
| 数据类型 | x32 | x64 | (Linux)Ubuntu |
| bool | 1 | 1 | |
| char | 1 | 1 | 1 |
| wchar_t | 2 | 2 | |
| int | 4 | 4 | 4 |
| float | 4 | 4 | 4 |
| double | 8 | 8 | 8 |
| long | 4 | 4 | 8 |
| long long | 8 | 8 |
VC6 ++ 不支持 long long数据类型,仅支持__int64(8字节)。
Ubuntu已经决定弃用x86架构。在未来版本中只支持64位版本。
参考文档:https://docs.microsoft.com/zh-cn/cpp/build/x64-software-conventions?view=vs-2019
浙公网安备 33010602011771号