C++中有多少个关键字?
C++总共有95个保留字。C++的保留字可以方便地分成几组。第一组包括那些也存在于C编程语言中并被沿用到C++中的保留字,共有32个。
另外还有30个保留字在C中不存在,因此是C++的新增保留字。
有11个C++保留字在使用标准ASCII字符集时并非必需,但它们被添加进来是为了提供一些C++运算符更易读的替代方案,并方便使用缺少C++所需字符的字符集进行编程。
以下是所有这些保留字的列表:
| alignas (自C++11) | alignof (自C++11) | and |
| and_eq | asm | atomic_cancel (TM TS) |
| atomic_commit (TM TS) | atomic_noexcept (TM TS) | auto(1) |
| bitand | bitor | bool |
| break | case | catch |
| char | char16_t (自C++11) | char32_t (自C++11) |
| class(1) | compl | concept (自C++20) |
| const | constexpr (自C++11) | const_cast |
| continue | co_await (coroutines TS) | co_return (coroutines TS) |
| co_yield (coroutines TS) | decltype (自C++11) | default(1) |
| delete(1) | do | double |
| dynamic_cast | else | enum |
| explicit | export(1) | extern(1) |
| false | float | for |
| friend | goto | if |
| import (modules TS) | inline(1) | int |
| long | module (modules TS) | mutable(1) |
| namespace | new | noexcept (自C++11) |
| not | not_eq | nullptr (自C++11) |
| operator | or | or_eq |
| private | protected | public |
| register(2) | reinterpret_cast | requires (自C++20) |
| return | short | signed |
| sizeof(1) | static | static_assert (自C++11) |
| static_cast | struct(1) | switch |
| synchronized (TM TS) | template | this |
| thread_local (自C++11) | throw | true |
| try | typedef | typeid |
| typename | union | unsigned |
| using(1) | virtual | void |
| volatile | wchar_t | while |
| xor | xor_eq |
广告
数据结构
网络
关系数据库管理系统 (RDBMS)
操作系统
Java
iOS
HTML
CSS
Android
Python
C编程
C++
C#
MongoDB
MySQL
Javascript
PHP