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 (協程 TS) | co_return (協程 TS) |
| co_yield (協程 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 (模組 TS) | inline(1) | int |
| long | module (模組 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 |
廣告
資料結構
網路
關係資料庫管理系統
作業系統
Java
iOS
HTML
CSS
Android
Python
C 程式設計
C++
C#
MongoDB
MySQL
Javascript
PHP