[fpc-pascal] declaration of functions

Michael Van Canneyt michael at freepascal.org
Fri Oct 15 11:27:57 CEST 2010



On Fri, 15 Oct 2010, Jonas Maebe wrote:

>
> On 15 Oct 2010, at 11:07, Sven Barth wrote:
>
>> Am 14.10.2010 14:50, schrieb Uffe Kousgaard:
>>> interface
>>> function somefunction(a: integer): integer;
>>> 
>>> implementation
>>> function somefunction;
>>> begin
>>> result:= a*2;
>>> end;
>> 
>> Add
>> 
>> {$mode delphi}
>> 
>> at the top of your unit, then this "Delhpi compatible" syntax will be 
>> enabled. The two default FPC modes (fpc and objfpc) are more strict than 
>> the Delphi one.
>
> As an aside, this has nothing to do with strictness. The reason is that FPC 
> and ObjFPC mode allow function overloading without the "overload" keyword. So 
> the compiler sees the above as two overloaded functions (one public, one 
> private) as opposed to the interface and implementation declaration of the 
> same function.

Isn't it amazing ? 2 core FPC developers give the same explanation :-)

Michael.



More information about the fpc-pascal mailing list