[fpc-pascal] TFPHashList and nil pointers

Serguei TARASSOV serge at arbinada.com
Tue May 19 11:06:21 CEST 2015


Hello,

Is it normal that TFPHashList cannot find an item by name if the pointer 
is nil?
However, the item is stored in the list.

FPC 2.6.4, both Windows and Linux versions.

program project1;

uses
   Contnrs;

var
   List: TFPHashList;
begin
   List := TFPHashList.Create;
   List.Add('Name1', List);
   List.Add('Name2', nil);
   writeln('List count: ', List.Count);
   writeln('Index of Name1: ', List.FindIndexOf('Name1'));
   writeln('Index of Name2: ', List.FindIndexOf('Name2'));
   List.Free;
end.

Output:
List count: 2
Index of Name1: 0
Index of Name2: -1

regards,
Serguei



More information about the fpc-pascal mailing list