我想在我的C代码中使用64位整数.我知道我可以#include< cstdint>然后声明一个uint64_t或使用unsigned long long(或等效的signed signed).
但是,似乎在C 11之前没有添加对此的支持,我希望我的代码与没有完全C 11支持的编译器兼容.
什么是在C中支持64位整数的便携方式?
解决方法
uint64_t是:
Optional: These typedefs are not defined if no types with such
characteristics exist.
正如你在ref中读到的那样.
从Should I use long long or int64_t for portable code?开始:
The types
long long
andunsigned long long
are standard C and standard C++ types each with at least 64 bits. All compilers I’m aware of provide these types,except possibly when in a-pedantic
mode but in this caseint64_t
oruint64_t
won’t be available with pre-C++ 2011 compilers,either. “
g / clang支持long long / int64_t的日期是什么?
Since 07002 (aka 07003).
正如DavidÁlvarez所说.