Prototyping functions

Some C compilers require each function to be declared with an ANSI-style prototype that indicates the placement and datatype of each argument received by the function. Other compilers do not recognize ANSI-style prototypes.

The PROTOTYPE macro allows forward declarations that are agreeable to both ANSI and non-ANSI compilers. This macro is used in forward declarations of C functions as:

PROTOTYPE (( argument_list ));

where argument_list is the ANSI-style argument list. PROTOTYPE is conditionally defined. If the compiler supports ANSI-style prototypes, then PROTOTYPE echos the argument list into the compiled code. Otherwise, PROTOTYPE echos nothing.

The following example illustrates the use of PROTOTYPE:

extern CS_RETCODE CS_PUBLIC ex_clientmsg_cb PROTOTYPE((
         CS_CONTEXT *context,
         CS_CONNECTION *connection,
         CS_CLIENTMSG *errmsg
         ));
CS_RETCODE CS_PUBLIC
 ex_clientmsg_cb(context, connection, errmsg)
 CS_CONTEXT      *context;
 CS_CONNECTION   *connection;
 CS_CLIENTMSG    *errmsg;
 {
    ... function body goes here ...
 }

CS_PUBLIC is used in callback function prototypes to make sure that machine-specific declaration requirements are satisfied. See “Declaring callbacks with CS_PUBLIC” for more information.