由于有多种类型的 64 位数据模型(LLP64/IL32P64、LP64/I32LP64、ILP64、SILP64),指定 64 位无符号整数文字的标准符合方式是什么?
指定 ULL 的后缀就足够了吗?还是我最终会导致文字在某些数据模型上被解释为 128 位?
最佳答案
您应该使用 <a href="http://www.cplusplus.com/reference/clibrary/cstdint/" rel="noreferrer noopener nofollow"><cstdint> / <stdint.h></a>
,如果你有的话。这会给你:
-
uint64_t
是一个无符号整数类型,大小为 64 位 -
UINT64_C()
是用于创建uint64_t
类型常量的宏, 通过让宏附加正确的后缀。
关于c++ - 在 64 位数据模型上指定 64 位无符号整数文字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13158501/