6.7.6 Type names

Previous Table of Contents

1613

type-name:
                specifier-qualifier-list abstract-declaratoropt

abstract-declarator: pointer pointeropt direct-abstract-declarator

direct-abstract-declarator: ( abstract-declarator ) direct-abstract-declaratoropt [ assignment-expressionopt ] direct-abstract-declaratoropt [ * ] direct-abstract-declaratoropt ( parameter-type-listopt )

1614 In several contexts, it is necessary to specify a type.

1615 This is accomplished using a type name, which is syntactically a declaration for a function or an object of that type that omits the identifier.126)

1616 EXAMPLE The constructions


        (a)        int
        (b)        int *
        (c)        int *[3]
        (d)        int (*)[3]
        (e)        int (*)[*]
        (f)        int *()
        (g)        int (*)(void)
        (h)        int (*const [])(unsigned int, ...)

name respectively the types (a) int, (b) pointer to int, (c) array of three pointers to int, (d) pointer to an array of three ints, (e) pointer to a variable length array of an unspecified number of ints, (f) function with no parameter specification returning a pointer to int, (g) pointer to function with no parameters returning an int, and (h) array of an unspecified number of constant pointers to functions, each with one parameter that has type unsigned int and an unspecified number of other parameters, returning an int.

1617 126) As indicated by the syntax, empty parentheses in a type name are interpreted as “function with no parameter specification”, rather than redundant parentheses around the omitted identifier.

Next

Created at: 2005-06-29 02:19:02 The text from WG14/N1124 is copyright © ISO