### 5.11 Function Types

Various types can be defined for function variables. These types are not used in defining functions (see Procedures); they are used for things like pointers to functions.

The simple, traditional, type is type descriptor ‘`f`’ is followed by type information for the return type of the function, followed by a semicolon.

This does not deal with functions for which the number and types of the parameters are part of the type, as in Modula-2 or ANSI C. AIX provides extensions to specify these, using the ‘`f`’, ‘`F`’, ‘`p`’, and ‘`R`’ type descriptors.

First comes the type descriptor. If it is ‘`f`’ or ‘`F`’, this type involves a function rather than a procedure, and the type information for the return type of the function follows, followed by a comma. Then comes the number of parameters to the function and a semicolon. Then, for each parameter, there is the name of the parameter followed by a colon (this is only present for type descriptors ‘`R`’ and ‘`F`’ which represent Pascal function or procedure parameters), type information for the parameter, a comma, 0 if passed by reference or 1 if passed by value, and a semicolon. The type definition ends with a semicolon.

For example, this variable definition:

         int (*g_pf)();

generates the following code:

         .stabs "g_pf:G24=*25=f1",32,0,0,0
             .common _g_pf,4,"bss"

The variable defines a new type, 24, which is a pointer to another new type, 25, which is a function returning `int`.