A declarator declares an object, function, or reference as part of a declaration.
A declarator has the following form:
Declarator syntax (C only) |--+----------------------+--direct_declarator------------------| | .------------------. | | V | | '---pointer_operator-+-'
Declarator syntax (C++ only) |--+-+----------------------+--direct_declarator-+--------------| | | .------------------. | | | | V | | | | '---pointer_operator-+-' | | (1) | '-trailing_return_type------------------------'
Direct declarator |--+-declarator_name-----------------------------------+--------| +-function_declarator-------------------------------+ +-direct_declarator--[--+---------------------+--]--+ | '-constant_expression-' | '-(--+----------------------+--direct_declarator--)-' | .------------------. | | V | | '---pointer_operator-+-'
Pointer operator (C++ only) |--+-*--+--------------------+--------------------------------+--| | '-type_qualifier_seq-' | +-&--------------------------------------------------------+ | (1) | +-&&-------------------------------------------------------+ '-+----+--nested_name_specifier--*--+--------------------+-' '-::-' '-type_qualifier_seq-'
Declarator name (C++ only) |--+----------------------------------------------+-------------| +-identifier_expression------------------------+ '-+----+--+-----------------------+--type_name-' '-::-' '-nested_name_specifier-'
For the details of function declarators, see Function declarators.For the details of trailing return types, see Trailing return type (C++11).
In addition, for compatibility with GNU C and C++, XL C/C++ allows you to use variable attributes to modify the properties of data objects. As they are normally specified as part of the declarator in a declaration, they are described in Variable attributes (IBM extension).