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.

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to