[Lazarus] TFPGList.Sort

Michael Van Canneyt michael at freepascal.org
Thu Oct 8 16:48:39 CEST 2015



On Thu, 8 Oct 2015, Andrea Mauri wrote:

> Dear all,
>
> I am trying to sort a simple TIntegerList defined as:
>
> TIntegerList = specialize TFPGList<Integer>;
>
> In order to sort I introduced a compare function as:
>
> function CompareInt(const Item1,
>  Item2: Integer): Integer;
> begin
>  if Item1 < Item2 then
>    Result:= -1
>  else if Item2 > Item1 then

This is wrong. It is in fact the same condition as your first if.
it should be
   if Item1>Item2 then

Michael.




More information about the Lazarus mailing list