[fpc-pascal] Delphi-FPC difference in handling TList
Bo Berglund
bo.berglund at gmail.com
Tue Oct 20 08:31:57 CEST 2015
I am porting a Delphi class to FPC and I ran into a problem concerning
TList:
FCommands.Sort(CommandCompare);
This generates an error:
Error: Wrong number of parameters specified for call to
"CommandCompare"
This call works just fine in Delphi and I have no clue as to why it
happens in FPC.
CommandCompare is a function that will compare two items based on the
properties of the object so the sort will be based on object
properties.
In this call to Sort the function is passed as a parameter rather than
being called...
>From Delphi help:
Delphi syntax:
procedure Sort(Compare: TListSortCompare);
Description
Call Sort to sort the items in the Items array. Compare is a
comparison function that indicates how the items are to be ordered.
I tried to typecast the function but it does not change anything:
FCommands.Sort(TListSortCompare(CommandCompare));
What am I missing?
--
Bo Berglund
Developer in Sweden
More information about the fpc-pascal
mailing list