c++ - `intmax_t` 在具有 64 位 `long int` 和 `long long int` 的平台上应该是什么?

标签 c++ c c++11

在 C++ 标准 18.4 中它指定:

typedef 'signed integer type' intmax_t;

根据具有 64 位 long int 和 64 位 long long int 的平台标准,这个“有符号整数类型”应该是?

请注意,long intlong long int不同的基本类型。

C++ 标准说:

The header defines all functions, types, and macros the same as 7.18 in the C standard.

在 C 标准 (N1548) 的 7.18 中,它说:

The following type designates a signed integer type capable of representing any value of any signed integer type:

intmax_t

在这种情况下,似乎 long intlong long int 都符合条件?

这是正确的结论吗?这两者都是符合标准的选择吗?

最佳答案

是的,你的推理是正确的。大多数现实世界的实现选择满足条件的最低等级类型。

关于c++ - `intmax_t` 在具有 64 位 `long int` 和 `long long int` 的平台上应该是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15279011/

相关文章:

c - 如何为 android jni 编译 Fluidsynth

c# - 如何在控制台应用程序中生成彩色 GUI?

c++ - 我可以对仅 move 类型的 vector 进行列表初始化吗?

c++ - 为什么 visual studio code 告诉我 cout 不是 std 命名空间的成员?

c++ - 点积/w Neon Intrinsics

c++ - 列表的析构函数删除虚拟 C++,基本问题

c++ - 编译一段最简单的代码时,VC++ 编译器崩溃

c++ - 如何使用STL中的容器读取文件

c++ - 无法在我的代码中使用 std::unordered_map

c - 动态创建的C字符串