Show: Object Pascal C++
Display Preferences


From Appmethod Topics
Jump to: navigation, search

Go Up to Functions Index

The general syntax for external function definitions is as follows:

External function definitions

  file  external-definition
  <decl-specifiers> declarator <declaration-list> function-body

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. 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.
Personal tools
In other languages