RAD Studio |  |

Definitions

The general syntax for external function definitions is as follows:

External function definitions

Copy Code

    file
        external-definition
         file  external-definition
    external-definition:
        function-definition
        declaration
        asm-statement
    function-definition:
        <declaration-specifiers> declarator <declaration-list>
        compound-statement

In general, a function definition consists of the following sections (the grammar allows for more complicated cases):

- 1. Optional storage class specifiers: extern or static. The default is extern.
- 2. A return type, possibly void. The default is int.
- 3. Optional modifiers: __pascal, __cdecl, __export__saveregs. The defaults depend on the compiler option settings.
- 4. The name of the function.
- 5. A parameter declaration list, possibly empty, enclosed in parentheses. In C, the preferred way of showing an empty list is func(void). The old style of func is legal in C but antiquated and possibly unsafe.
- 6. A function body representing the code to be executed when the function is called.

Note: You can mix elements from 1 and 2.

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!