CBFalconer wrote:
Neil Santos wrote:
How does GPC support function/procedure overloading when it allows the declaration of parameters to be skipped when it comes to the implementation of a function/procedure?
I read somewhere that a function/procedure declaration in an interface need not be duplicated for the implementation. UIM, the text referred to Extended Pascal.
Say function foo is declared like this in the interface section of a module:
function foo(bar : integer) : some_return_type;
In the implementation, one could just do:
function foo; begin {do interesting stuff here} end;
Is it possible to overload foo (i.e., to accept a baz parameter, aside from bar) without resorting to having two code blocks with slightly different parameter declarations?
No. At least in ISO7185 the forward declaration must include the forward attribute, as in:
FUNCTION foo(bar : integer) : some_return_type; FORWARD;
That's why Extended Pascal is ISO 10206. :-)
and the actual function declaration must either be a duplicate, omitting the FORWARD, or omit all parameter specifications.
Same in module implementations.
Frank