The spec is obviously vague to the point of being almost useless, but my understanding is that in practice the integer types are always as follows:
规范显然是模糊到几乎无用的,但我的理解是在实践中整数类型总是如下:
-
int
- 16 bit on ancient 16 bit systems, otherwise always 32 bits even on 64 bit architectures - int - 古代16位系统上的16位,即使在64位架构上也是32位
-
long
- always 32 bits - 长 - 总是32位
-
long long
- always 64 bits - 很长 - 总是64位
-
size_t
- 32 bit on 32 bit systems, 64 bits on 64 bit systems (unsigned) - size_t - 32位系统上的32位,64位系统上的64位(无符号)
Is that table really correct? Are there any significant implementations that violate it?
那张桌子真的对吗?有没有违反它的重要实施?
Updated Table based on responses below
根据以下回复更新了表格
-
int
- 16 bit on ancient 16 bit systems, otherwise always 32 bits even on 64 bit architectures - int - 古代16位系统上的16位,即使在64位架构上也是32位
-
long
- may be 32 or 64 bit on 64 bit systems. (Windows 32, *nix usually 64) - long - 在64位系统上可能是32位或64位。 (Windows 32,* nix通常为64)
-
long long
- always 64 bits - 很长 - 总是64位
-
size_t
- 32 bit on 32 bit systems, 64 bits on 64 bit systems (unsigned) - size_t - 32位系统上的32位,64位系统上的64位(无符号)
1 个解决方案
#1
2
long - always 32 bits
长 - 总是32位
That's wrong assumption. There are platforms with 64-bit long
I think you can begin from here
这是错误的假设。有64位长的平台我想你可以从这里开始
#1
2
long - always 32 bits
长 - 总是32位
That's wrong assumption. There are platforms with 64-bit long
I think you can begin from here
这是错误的假设。有64位长的平台我想你可以从这里开始