6.4.1 关键字
6.4.1 关键字列表
- 下列记号在翻译阶段 7 和 8 中保留为关键字使用;除属性记号中的情形外,不得另作他用:
关键字总表
text
alignas do int struct while
alignof double long switch _Atomic
auto else nullptr thread_local _BitInt
bool enum register true _Complex
break extern restrict typedef _Decimal128
case false return typeof _Decimal32
char float short typeof_unqual _Decimal64
const for signed union _Generic
constexpr goto sizeof unsigned _Imaginary
continue if static void _Noreturn
default inline static_assert volatile1
2
3
4
5
6
7
8
9
10
11
2
3
4
5
6
7
8
9
10
11
关键字区分大小写。
_Imaginary保留给虚数类型说明使用。
6.4.1 关键字的替代拼写
- 标准还为少数关键字提供了替代拼写。这些替代拼写在能使用原关键字的地方,也都可以使用。
| 关键字 | 替代拼写 |
|---|---|
alignas | _Alignas |
alignof | _Alignof |
bool | _Bool |
static_assert | _Static_assert |
thread_local | _Thread_local |
这些替代拼写属于将被淘汰的特性;新代码不应继续优先使用它们。
在受
#与##预处理运算符影响的表达式内部,这些关键字、其替代拼写,以及false、true的拼写结果未指定。
NOTE
这里“拼写结果未指定”是为了给实现保留空间,例如允许通过预定义宏的方式实现某些语言特性,而不是要求所有实现都以完全相同的文本形式工作。