/sys$common/syshlp/helplib.hlb
CC, Language topics, Declarations

 *Conan The Librarian (sorry for the slow response - running on an old VAX)

  Declarations specify the functions and variables referenced in a
  program.  Declarations in C have the following syntax:

        declaration:

           declaration-specifiers [init-declarator-list];

        declaration-specifiers:

           storage-class-specifier [declaration-specifiers]
           type-specifier [declaration-specifiers]
           type-qualifier [declaration-specifiers]

        init-declarator-list:

           init-declarator
           init-declarator-list, init-declarator

        init-declarator:

           declarator
           declarator = initializer

  Note the following items about the general syntax of a declaration:

   o  The storage-class-specifier, type-qualifier, and type-specifier
      can be listed in any order.  All are optional, but, except for
      function declarations, at least one such specifier or qualifier
      must be present.  Placing the storage-class-specifier anywhere
      but at the beginning of the declaration is an obsolete style.

   o  Storage-class keywords are auto, static, extern, and register.

   o  Type qualifiers are const, volatile, and __restrict.

   o  The declarator is the name of the object being declared.  A
      declarator can be as simple as a single identifier, or can be a
      complex construction declaring an array, structure, pointer,
      union, or function (such as *x, tree(), and treebar[10]).

   o  Initializers are optional and provide the initial value of an
      object.  An initializer can be a single value or a
      brace-enclosed list of values, depending on the type of object
      being declared.

   o  A declaration determines the beginning of an identifier's
      scope.

   o  An identifier's linkage is determined by the declaration's
      placement and its specified storage class.

  Consider the following example:

       volatile static int var_number = 10;

 This declaration shows a qualified type (a type, int, with a type
 qualifier, volatile), a storage class (static), a declarator (data),
 and an initializer (10).  This declaration is also a definition,
 because storage is reserved for the data object var_number.

 For more information, see HELP CC LANGUAGE_TOPICS DATA_TYPES, HELP
 CC LANGUAGE_TOPICS STORAGE_CLASSES, and HELP CC LANGUAGE_TOPICS
 TYPE_QUALIFIERS.

  Additional Information (explode) :

  Close     HLB-list     TLB-list     Help  

[legal] [privacy] [GNU] [policy] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.