C++ Reserved Words

Home / C++ Reserved Words

C++ Reserved Words

December 11, 2015 | Article | No Comments

C++ reserves some words for its own use and for use in C++ libraries. Thus, we shouldn’t use a reserved word as an identifier in a declaration. Reserved words comes in two categories: keywords and alternative tokens.

This article will list C++ reserved words based on C++11 standard.

C++ Keywords

Keywords are identifiers that form the vocabulary or a programming language. By combining the keyword and following the grammar of C++, we do code with C++. These vocabulary may not be used for other purpose, such as serving as variable names.

The following list show C++’s keywords:

[table “7” not found /]

Alternative Tokens

In addition to keywords, C++ has some alphabetic alternative representations of operators, termed alternative tokens. These, too, are reserved.

[table “8” not found /]

Notes

The meaning of “auto” keyword has changed in C++11. In C++11 standard, the auto keyword is used to declare a variable with type inferred from the expression or value assigned to it.

In addition to keywords, there are two identifiers with special meaning, which maybe used as names of objects or functions, but have special meaning in certain contexts.

override
final

Also, each name that contains a double underscore __ or begins with an underscore followed by an uppercase letter is always reserved to the implementation and should not be used as an identifier. Each name that begins with an underscore is reserved to the implementation for use as a name in the global namespace; such names may be used as identifiers in user-defined namespaces, as names of class members, etc.

The name posix is reserved for a future top-level namespace. The behavior is undefined if a program declares or defines anything in that namespace.(since C++11)

About Author

about author

xathrya

A man who is obsessed to low level technology.

Leave a Reply

Your email address will not be published. Required fields are marked *

Social media & sharing icons powered by UltimatelySocial