Go to the first, previous, next, last section, table of contents.


5.2.5 Typedef Specifiers

As in C++, a typedef declaration makes synonyms for types. For example, after the following declarations:

typedef struct { double re, im; } complex;
typedef int (*pif)(int);

the names complex and pif can be used as the names of types (see section 5.2.3 Type Specifiers).

Since a typedef is an abbreviation, uses of the name defined in a typedef are semantically equivalent to the use of the type's meaning. Sometimes this meaning will be, as in the case of the declaration of complex above, something that does not otherwise have a name.

In C++ and Larch/C++ there is no need to use typedefs to define struct or union types. So one should write the above declaration of complex as follows.

struct complex { double re, im; };


Go to the first, previous, next, last section, table of contents.