[fpc-pascal] declaration of functions

Sven Barth pascaldragon at googlemail.com
Fri Oct 15 11:43:09 CEST 2010


Am 15.10.2010 11:27, schrieb Michael Van Canneyt:
>
>
> 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 :-)

Should I be worried that you find this amazing? O.o

Regards,
Sven



More information about the fpc-pascal mailing list