c++ - 缩写类型名称 long long 与 long long int,是否符合标准?

标签 c++ c++11 types language-lawyer

我看到的大多数代码都使用缩写类型来声明变量,例如

long long x; // long long int x
short y; // short int y

我浏览了 C++11 标准(第 3.9.1 节),类型总是完整声明的,如 long long int。我找不到任何关于缩写类型的提及。我很确定这些缩写符合标准,但想确定是否确实如此。所以我的问题是上面的代码是否完全符合标准。

最佳答案

是的,这是有效的,它包含在 draft C++11 standard7.1.6.2 简单类型说明符部分说:

Table 10 summarizes the valid combinations of simple-type-specifiers and the types they specify.

在表 10 simple-type-specifiers and the types they specified 中说:

long long      “long long int”

和:

short          “short int”

关于c++ - 缩写类型名称 long long 与 long long int,是否符合标准?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28153959/

相关文章:

c++ - 构造函数主体前的冒号是否表示继承

c++ - ISO C++ 禁止声明没有类型的 ‘Expresion’

c++ - C++中的评估顺序初始化数组

c++模板和const(使用auto没有编译器警告的违规行为)

python - Python 中的类型检查

python - 将 python int 转换为 int16_t 类型

c++ - 原子 int 不正确地递增?英特尔 TBB 实现

C++ 11 实现接口(interface)的方法不可用。为什么?

c++ - C++11 中的垃圾回收

java - 我可以使用原始类作为类型并仍然使用它的子类吗?