นิยาม
Reserved word คือคำที่ไม่สามารถใช้เป็น identifier ได้ (เช่นชื่อตัวแปร ฟังก์ชัน หรือ label) ถูก "สงวนไว้" ไม่ให้ใช้งาน นี่เป็นนิยามทาง syntax คำสงวนอาจไม่มีความหมายด้วยตัวเอง
สถิติ
- รวม 95 คำสงวนใน C++
- 32 คำมาจาก C language
- 30 คำใหม่เฉพาะ C++
- 11 คำเป็นตัวเลือกสำหรับ character set ที่ขาดบางตัวอักษร (alternative tokens)
รายการคำสงวนทั้งหมด (บางส่วน)
| คำสงวน | คำสงวน | คำสงวน |
|---|---|---|
| alignas (C++11) | alignof (C++11) | and |
| and_eq | asm | atomic_cancel (TM TS) |
| atomic_commit (TM TS) | atomic_noexcept (TM TS) | auto |
| bitand | bitor | bool |
| break | case | catch |
| char | char16_t (C++11) | char32_t (C++11) |
| class | 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 |
| delete | do | double |
| dynamic_cast | else | enum |
| explicit | export | extern |
| false | float | for |
| friend | goto | if |
| import (modules TS) | inline | int |
| long | module (modules TS) | mutable |
| namespace | new | noexcept (C++11) |
| not | not_eq | nullptr (C++11) |
| operator | or | or_eq |
| private | protected | public |
| register | reinterpret_cast | requires (C++20) |
| return | short | signed |
| sizeof | static | static_assert (C++11) |
| static_cast | struct | switch |
| synchronized (TM TS) | template | this |
| thread_local (C++11) | throw | true |
| try | typedef | typeid |
| typename | union | unsigned |
| using | virtual | void |
| volatile | wchar_t | while |
| xor | xor_eq |