Computer >> Hướng Dẫn Máy Tính >  >> Lập Trình >> C++

C++ có bao nhiêu từ khóa?


Tổng cộng có 95 từ khóa dành riêng (reserved words) trong C++. Chúng có thể phân nhóm như sau:

  • 32 từ khóa kế thừa từ C.
  • 30 từ khóa mới chỉ có trong C++.
  • 11 từ khóa thay thế cho các toán tử (để dễ đọc hơn và hỗ trợ tập ký tự thiếu).

Dưới đây là danh sách đầy đủ (bao gồm từ khóa C++11, C++20, Technical Specifications):

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