Keywords

This page lists all of the C++ keywords, and either links to a reference page explaining their use, or provides a brief description.

List of Keywords

The C++ keywords are:

and, and_eq, asm, auto, bitand, bitor, bool, break, case, catch, char, class, compl, const, const_cast, continue, default, delete, do, double, dynamic_cast, else, enum, explicit, export, extern, false, float, for, friend, goto, if, inline, int, long, mutable, namespace, new, not, not_eq, operator, or, or_eq, private, protected, public, register, reinterpret_cast, return, short, signed, sizeof, static, static_cast, struct, switch, template, this, throw, true, try, typedef, typeid, typename, union, unsigned, using, virtual, void, volatile, wchar_t, while, xor, xor_eq

Boolean Operator Synonyms

  • and is a synonym for &&.
  • not is a synonym for !.
  • not_eq is a synonym for !=.
  • or is a synonym for ||.

Bitwise Operator Synonyms

  • and_eq is a synonym for &=.
  • bitand is a synonym for (bitwise) &.
  • bitor is a synonym for |.
  • compl is a synonym for ~.
  • or_eq is a synonym for |=.
  • xor is a synonym for ^.
  • xor_eq is a synonym for ^=.

Constants

Control Flow

Types

The following keywords are used for built-in types.

The following keywords are used to introduce new types.

Qualifiers

  • static can be used to declare persistent local variables; it has other uses not documented here.
  • unsigned is used to specify an unsigned integral type. Examples: unsigned int, unsigned char.
  • volatile is useful when declaring variables that may be modified by external interrupts.
  • const is used to define constants.

Other

These keywords are not described in the Maple documentation. For more information, consult a C++ reference.

  • asm is used to insert literal assembly language.
  • auto is used to declare that a variable has automatic storage.
  • catch is used in exception handling. Note that the default flags we pass to GCC include -fno-exceptions.
  • class is used to define classes.
  • const_cast is used in typecasting.
  • delete is used to free new-allocated storage. Note that dynamic memory allocation is not available by default on the Maple, so you’ll have to bring your own new and delete if you want this.
  • dynamic_cast is used in typecasting.
  • explicit is used to declare constructors that can be called only explicitly.
  • export declares a template definition accessible to other compilation units.
  • extern can mark a declaration as a declaration and not a definition, and also grant external linkage to a const or typedef.
  • friend is used to declare that certain functions have access to a class’s private variables.
  • inline is a compiler hint to inline a function.
  • mutable specifies that a member can be updated, even when a member of a const object.
  • namespace declares a new namespace.
  • new dynamically allocates space for a value. Note that dynamic memory allocation is not available by default on the Maple, so you’ll have to bring your own new and delete if you want this.
  • operator is used to define type-specific operator overrides.
  • private declares a private class member.
  • protected declares a protected class member.
  • public declares a public class member.
  • register is a compiler hint to store a variable in a register.
  • reinterpret_cast is used in typecasting.
  • signed is the opposite of unsigned.
  • static_cast is used in typecasting.
  • struct declares a new struct.
  • template introduces a template class, function, etc.
  • this is a pointer to the receiver object.
  • throw is used in exception handling. Note that the default flags we pass to GCC include -fno-exceptions.
  • try is used in exception handling. Note that the default flags we pass to GCC include -fno-exceptions.
  • typedef defines a type synonym.
  • union defines an untagged union.
  • using is a directive related to namespaces.
  • virtual declares a method which may be overridden.
  • wchar_t is the wide character type.

Table Of Contents