- C++ 中有可移植的 unsigned long 吗?
- 有没有办法制作可移植结构?
在我家的机器上 unsigned long 是 8 个字节。在工作机器上它是 4 个字节。 当您在家中启动工作中编写的应用程序时,存在通过网络传输的数据正确性的问题。
谢谢。
最佳答案
#include <stdint.h>
对于以下类型定义:
-
(u)int8_t
-
(u)int16_t
-
(u)int32_t
-
(u)int64_t
虽然最后一个可能可用也可能不可用,具体取决于平台。
关于c++ - C/C++ 中的可移植无符号长整型,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6378738/