HP 3000 Manuals

Type Names [ HP C/iX Reference Manual ] MPE/iX 5.0 Documentation


HP C/iX Reference Manual

Type Names 

A type name is syntactically a declaration of an object or a function of
a given type that omits the identifier.  Type names are often used in
cast expressions and as operands of the sizeof operator.

Syntax 

     type-name ::=
         specifier-qualifier-list [abstract-declarator] 

     abstract-declarator ::=
         pointer 
         [pointer] direct-abstract-declarator 

     direct-abstract-declarator 
         ( abstract-declarator )
         [direct-abstract-declarator] [ [constant-expression] ]
         [direct-abstract-declarator] ( [parameter-type-list] )

Description 

Type names are enclosed in parentheses to indicate a cast operation.  The
destination type is the type named in the cast; the operand is then
converted to that type.

A type name is a declaration without the identifier specified.  For
example, the declaration for an integer is int i.  If the identifier is
omitted, only the integer type int remains.

Examples 

          int             int 
          int *           Pointer to int 
          int ()          Function returning an int 
          int *()         Function returning a pointer to int 
          int (*)()       Pointer to function returning an int 
          int [3];        Array of 3 int 
          int *[3];       Array of 3 pointers to int 
          int (*)[3];     Pointer to an array of 3 int 

The parentheses are necessary to alter the binding order in the cases of
pointer to function and pointer to array.  This is because function and
array declarators have higher precedence than the pointer declarator.



MPE/iX 5.0 Documentation