C++ Programming: Language Keywords

From Wikibooks, open books for an open world
Jump to: navigation, search

[edit] ISO C++ (C++98) keywords

  • and
  • and_eq
  • asm
  • auto
  • bitand
  • bitor
  • bool
  • break
  • case
  • catch
  • char
  • class
  • compl
  • const
  • const_cast
  • continue
  • default
  • delete
  • do

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 next revision of C++, informally known as C++0x for now, is likely to add some keywords, probably including at least:

  • static_assert
  • decltype
  • nullptr

(These are being considered carefully to minimize breakage to existing code; see http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2006/n2105.html for some details.)

Old compilers may not recognize some or all of the following keywords:

  • and
  • and_eq
  • bitand
  • bitor
  • bool
  • catch
  • compl
  • const_cast
  • typeid
  • typename
  • using
  • wchar_t
  • xor
  • xor_eq

[edit] C++ reserved identifiers

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: https://waybackassets.bk21.net/20040209031039/http://oakroadsystems.com/tech/c-predef.htm#ReservedIdentifiers

Clipboard

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

Personal tools
Namespaces

Variants
Actions
Navigation
Community
Toolbox
Sister projects
Print/export