C++ Programming: Language Keywords

ISO C++ keywords edit

The C++98 standard recognized the following keywords:

Specific compilers may (in a non-standard compliant mode) also treat some other words as keywords, including cdecl, far, fortran, huge, interrupt, near, pascal, typeof. Old compilers may recognize the overload keyword, an anachronism that has been removed from the language.

The current revision of C++, known as C++11, added some keywords:

  • alignas
  • alignof
  • char16_t
  • char32_t
  • constexpr
  • decltype
  • noexcept
  • nullptr
  • static_assert
  • thread_local

C++11 also added two special words which act like keywords in some contexts, but can be used as ordinary identifiers most of the time:

  • final
  • override

It would be bad practice to use these as identifiers when writing new code.

The C++98 keywords auto, default, delete and using have additional or changed uses in C++11.

Some old C++98 compilers may not recognize some or all of the following keywords:

  • typeid
  • typename
  • using
  • wchar_t
  • xor
  • xor_eq

C++ reserved identifiers edit

Some "nonstandard" identifiers are reserved for distinct uses, to avoid conflicts on the naming of identifiers by vendors, library creators and users in general.

Reserved identifiers include keywords with two consecutive underscores (__), all that start with an underscore followed by an uppercase letter and some other categories of reserved identifiers carried over from the C library specification.

A list of C reserved identifiers can be found at the Internet Wayback Machine archived page: http://web.archive.org/web/20040209031039/http://oakroadsystems.com/tech/c-predef.htm#ReservedIdentifiers


 

To do:
It would be nice to list those C reserved identifiers, for the moment All Standard C Library Functions have already been listed