| 1 |
<refentry id="funcparams.element"> |
| 2 |
<?dbhtml filename="funcparams.html"?> |
| 3 |
<refentryinfo> |
| 4 |
<pubdate>$Date$</pubdate> |
| 5 |
<releaseinfo>$Revision$</releaseinfo> |
| 6 |
</refentryinfo> |
| 7 |
|
| 8 |
<refmeta> |
| 9 |
<indexterm><primary>elements</primary> |
| 10 |
<secondary>funcparams</secondary></indexterm> |
| 11 |
<refentrytitle>funcparams</refentrytitle> |
| 12 |
<refmiscinfo>Element</refmiscinfo> |
| 13 |
</refmeta> |
| 14 |
<refnamediv> |
| 15 |
<refname>funcparams</refname> |
| 16 |
<refpurpose>&funcparams.purpose;</refpurpose> |
| 17 |
</refnamediv> |
| 18 |
|
| 19 |
&funcparams.synopsis.gen; |
| 20 |
<refsect1 condition='ref.description'><title>Description</title> |
| 21 |
|
| 22 |
<para> |
| 23 |
In some programming languages (like C), it is possible for a |
| 24 |
function to have a pointer to another |
| 25 |
function as one of its parameters. In the syntax summary for such a function, the |
| 26 |
<sgmltag>FuncParams</sgmltag> element provides a wrapper for the |
| 27 |
function pointer. |
| 28 |
</para> |
| 29 |
|
| 30 |
<para> |
| 31 |
For example, the following prototype describes the function |
| 32 |
<function>sort</function>, which takes two parameters. The first |
| 33 |
parameter, <parameter>arr</parameter>, is an array of integers. The second |
| 34 |
parameter is a pointer to a function, <function>comp</function> that returns |
| 35 |
an <type>int</type>. The <function>comp</function> function takes two parameters, |
| 36 |
both of type <type>int *</type>: |
| 37 |
|
| 38 |
<screen> |
| 39 |
<![CDATA[ |
| 40 |
<funcprototype> |
| 41 |
<funcdef>void <function>sort</function></funcdef> |
| 42 |
<paramdef>int *<parameter>arr</parameter>[]</paramdef> |
| 43 |
<paramdef>int <parameter>(* comp)</parameter> |
| 44 |
<funcparams>int *, int *</funcparams></paramdef> |
| 45 |
</funcprototype> |
| 46 |
]]> |
| 47 |
</screen> |
| 48 |
</para> |
| 49 |
|
| 50 |
<refsect2><title>Processing expectations</title> |
| 51 |
<para> |
| 52 |
&format.inline; For a complete description of the processing expecations, |
| 53 |
see <sgmltag>FuncSynopsis</sgmltag>. |
| 54 |
</para> |
| 55 |
</refsect2> |
| 56 |
|
| 57 |
<refsect2 role='fu' revision="4.0"><title>&FutureChanges;</title> |
| 58 |
<para> |
| 59 |
|
| 60 |
&fu.interfacedefinition; |
| 61 |
</para> |
| 62 |
</refsect2> |
| 63 |
|
| 64 |
|
| 65 |
&funcparams.parents.gen; |
| 66 |
&funcparams.children.gen; |
| 67 |
</refsect1> |
| 68 |
<refsect1 condition='ref.elem.seealso'><title>See Also</title> |
| 69 |
&funcparams.seealso.gen; |
| 70 |
</refsect1> |
| 71 |
<refsect1><title>Examples</title> |
| 72 |
|
| 73 |
<informalexample role="example-source"> |
| 74 |
<programlisting>&funcparams.example.1.txt;</programlisting> |
| 75 |
</informalexample> |
| 76 |
|
| 77 |
<anchor id="ex.os.funcparams.1" role="HACK-ex.out.start"/> |
| 78 |
&funcparams.example.1.gen; |
| 79 |
<anchor id="ex.oe.funcparams.1" role="HACK-ex.out.end"/> |
| 80 |
|
| 81 |
&funcparams.example.seealso.gen; |
| 82 |
</refsect1> |
| 83 |
</refentry> |
| 84 |
|