About GPC's support of func/proc overloading

Neil Santos nsantos at sexmagnet.com
Mon Feb 23 21:13:33 CET 2004


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?

And on a slightly related question: Does GPC support, as an extension to 
Pascal, optional paramaters the way Ada supposedly does?  If so, could 
someone please point me towards the direction I should go in order to 
find out how?  If not, does anyone else think that this would be a 
useful extension?

Thanks for your time.
-- 
- Neil Santos                    Freelance Programmer & Web Designer   -
- http://nsantos.f2o.org/                     Free Software advocate   -

-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GAT d+@ s+:+ a? C++++ UL*++++ P++ L++ E--- W+++(--) N-- !o !K w(++) !O
M-- V? PS++ PE-- Y++ PGP+ t* 5-- X- R++ tv+ b++>+++ DI+++ D--- G e>+++++
h r++ y?
------END GEEK CODE BLOCK------

Please avoid sending me attachments created with proprietary software.
See http://www.fsf.org/philosophy/no-word-attachments.html




More information about the Gpc mailing list