11.10 Declaring parameters for stack call functions

----------------------------------------------------

In earlier versions of C--, control of the number and type of

parameters transferred to a function used to be was the job of the

programmer. It was a difficult job to coordinate the simultaneous lack of

control of parameters (for compatibility with previous versions) with

adding control. Various compromises produced something which differs

somewhat from traditional C type languages.

In C--, before you can switch on control of stack function parameters,

a parameter must be declared. But not just any function declaration signals

the compiler that control of parameters of this function is being switched

on. Unless the declaration contains something in parentheses, the compiler

will not keep track of the parameters transferred to this function. In C++

this sort of declaration indicates that no parameters are passed to the

function. In C-- this is accomplished in the function declaration by

writing void in parentheses. For example:

int proc ( void ) ;

On encountering such a function declaration, the compiler will make

sure that no parameters are passed to this function.

When declaring a function, parameter names may be omitted. In C--

function parameters of the same time are separated by commas. Changes of

type are marked by using semicolons. In the declaration, a change of type

may occur even after a comma:

void ptoc ( int a, b, c; word d );

void proc ( int, int, int, word );

void proc ( int, int, int; word );

All these example of declarations are identical and correct.

When checking for functions with a variable number of parameters, C--

now has a new element of syntax - an ellipsis. Here is an example of the

declaration of printf:

void cdecl printf ( word, ... );