4 <meta http-equiv=
"Content-Type" content=
"text/html">
5 <meta name=
"description" content=
"STABS">
6 <meta name=
"generator" content=
"makeinfo 4.3">
7 <link href=
"http://www.gnu.org/software/texinfo/" rel=
"generator-home">
12 Node:
<a name=
"Function%20Types">Function Types
</a>,
13 Previous:
<a rel=
"previous" accesskey=
"p" href=
"Unions.html#Unions">Unions
</a>,
14 Up:
<a rel=
"up" accesskey=
"u" href=
"Types.html#Types">Types
</a>
18 <h3 class=
"section">Function Types
</h3>
20 <p>Various types can be defined for function variables. These types are
21 not used in defining functions (see
<a href=
"Procedures.html#Procedures">Procedures
</a>); they are used for
22 things like pointers to functions.
24 <p>The simple, traditional, type is type descriptor
<code>f
</code> is followed by
25 type information for the return type of the function, followed by a
28 <p>This does not deal with functions for which the number and types of the
29 parameters are part of the type, as in Modula-
2 or ANSI C. AIX provides
30 extensions to specify these, using the
<code>f
</code>,
<code>F
</code>,
<code>p
</code>, and
31 <code>R
</code> type descriptors.
33 <p>First comes the type descriptor. If it is
<code>f
</code> or
<code>F
</code>, this
34 type involves a function rather than a procedure, and the type
35 information for the return type of the function follows, followed by a
36 comma. Then comes the number of parameters to the function and a
37 semicolon. Then, for each parameter, there is the name of the parameter
38 followed by a colon (this is only present for type descriptors
<code>R
</code>
39 and
<code>F
</code> which represent Pascal function or procedure parameters),
40 type information for the parameter, a comma,
0 if passed by reference or
41 1 if passed by value, and a semicolon. The type definition ends with a
44 <p>For example, this variable definition:
46 <pre class=
"example"> int (*g_pf)();
49 <p>generates the following code:
51 <pre class=
"example"> .stabs
"g_pf:G24=*25=f1",
32,
0,
0,
0
55 <p>The variable defines a new type,
24, which is a pointer to another new
56 type,
25, which is a function returning
<code>int
</code>.