The following are all parts of a declaration: specifier, base type, declarator, and initializer.
The format of a declaration is:
[specifier] <base type> <declarator> [initializer];
An example of a declaration with all of the parts is:
const int i = 9;
Where
'const' is a specifier
'int' is the base type
'i' is the declarator
'= 9' is the initializer
Notes:
1. The declarator is the name of the object, type or function
that is introduced into a scope by the declaration.
2. The following are examples of specifiers:
{extern, static, mutable, auto, register} -- Storage Class Specifiers
{virtual, inline, explicit} -- Function Specifiers
{const, volatile} -- cv-qualifiers (also Type Specifiers)
{struct, class, union, typename} -- Class Specifiers
{long, long long, short, signed, unsigned} -- Type Specifiers
{enum} -- enum Specifier
{private, public, protected} -- Access Specifiers
friend, inline, typedef
template
References:
The C++ Programming Language by Bjarne Stroustrup. Addison-Wesley, 2000. Section: 4.9.1
http://www.kuzbass.ru/docs/isocpp/dcl.html
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment