[fpc-pascal] sorting and merging array of records

Sven Barth pascaldragon at googlemail.com
Thu Jan 12 10:04:27 CET 2012


Am 12.01.2012 03:34, schrieb waldo kitty:
> On 1/11/2012 20:35, Tomas Hajny wrote:
>> No, Insert doesn't do any copying by default. In your current code,
>> the copying is performed by calling the PTLERec constructor (in
>> "New(PTLERec, Init(...") but if the pointer isn't inserted, it is
>> thrown away currently.
>
> thrown away by the default object insert code? why doesn't it properly
> wipe it out since it is tossing the pointer into the bitbucket?

It can not make any assumption about your pointer. In theory your 
collection could contain Integers that were simply casted to Pointers. 
In that case a "disposing of the pointer's data" would be fatal!

> i just gotta figure out the way that the search and such work as in if
> they are returning pointers to the record or the record data itself...
> pointers are still very alien to me :? :/

The methods return Pointers which you can cast to PTLERec. This you can 
then access like a usual object (e.g. dereferencing, etc)

Regards,
Sven



More information about the fpc-pascal mailing list