A.8.9 Typedef

Declarations whose storage class specifier is typedef do not declare objects; instead they define identifiers that name types. These identifiers are called typedef names.

A typedef declaration attributes a type to each name among its declarators in the usual way (see Par.A.8.6). Thereafter, each such typedef name is syntactically equivalent to a type specifier keyword for the associated type.

For example, after

the constructions

are legal declarations. The type of b is long, that of bp is pointer to long, and that of z is the specified structure; zp is a pointer to such a structure.

typedef does not introduce new types, only synonyms for types that could be specified in another way. In the example, b has the same type as any long object.

Typedef names may be redeclared in an inner scope, but a non-empty set of type specifiers must be given. For example,

does not redeclare Blockno, but

does.

TCPL/A.08.09_Typedef (2008-02-23 15:34:53由localhost编辑)

ch3n2k.com | Copyright (c) 2004-2020 czk.