Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2015-05

Re: fpc-pascal Digest, Vol 131, Issue 19

2 messages · 2 people · –

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Serguei TARASSOV
Show quoted text 43 lines
Date: Wed, 20 May 2015 13:11:10 +0200 (CEST) From: Michael Van Canneyt To: FPC-Pascal users discussions Subject: Re: [fpc-pascal] TFPHashList and nil pointers Message-ID: Content-Type: TEXT/PLAIN; charset=US-ASCII; format=flowed On Tue, 19 May 2015, Serguei TARASSOV wrote: > >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 It is by design. Michael.

Michael,

Thank for answer.
I would be a good idea to add this limitation in doc.

Regards,
Serguei

Reply by email

Michael Van Canneyt
to Serguei TARASSOV
Serguei TARASSOV wrote 12 lines
>> > >> >Output: >> >List count: 2 >> >Index of Name1: 0 >> >Index of Name2: -1 > It is by design. > > Michael. Michael, Thank for answer. I would be a good idea to add this limitation in doc.

Yes. I have already done so after answering you :)

Michael.

Reply by email