Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-28 Thread Tomas Hajny
On Thu, November 28, 2013 09:03, Sven Barth wrote: > Am 28.11.2013 08:33, schrieb Andreas Schneider: >> Maybe a bit late, but that might not be true. If Timothy really talks >> about _object_ (and not _class(TObject)_) it should work as he does >> it. Also Destroy would probably be appropriate. Jus

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-28 Thread Sven Barth
Am 28.11.2013 08:33, schrieb Andreas Schneider: Maybe a bit late, but that might not be true. If Timothy really talks about _object_ (and not _class(TObject)_) it should work as he does it. Also Destroy would probably be appropriate. Just saying :-) The actual type defs used are missing. Unli

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-27 Thread Andreas Schneider
On Saturday, November 16, 2013, at 02:36 Martin wrote: > On 16/11/2013 01:03, Timothy Groves wrote: >> >> Here's the code I *actually* have in the method: >> >> var >> index, >> last : integer; >> begin >> last := length (t_volumes) - 1; >> index := 0; >> while ((t_volumes [index] <> t_cu

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-16 Thread Jonas Maebe
On 16 Nov 2013, at 02:36, Martin wrote: > On 16/11/2013 01:03, Timothy Groves wrote: >> [last].Destroy; > > destroys the object pointed to by both: t_volumes [last] and t_volumes [index] > > You should have destroyed t_volumes [index] *before* copying the value And you should call Free inste

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-16 Thread Sven Barth
On 16.11.2013 02:03, Timothy Groves wrote: This produces bad results, as it currently sits. What am I doing wrong? Here's the code I *actually* have in the method: var index, last : integer; begin last := length (t_volumes) - 1; index := 0; while ((t_volumes [index] <> t_current

Re: [fpc-pascal] Re: Objects in dynamic arrays

2013-11-15 Thread Martin
On 16/11/2013 01:03, Timothy Groves wrote: Here's the code I *actually* have in the method: var index, last : integer; begin last := length (t_volumes) - 1; index := 0; while ((t_volumes [index] <> t_current_volume) and (index < last)) do inc (index); if (index < last) then be

[fpc-pascal] Re: Objects in dynamic arrays

2013-11-15 Thread Timothy Groves
On 13-11-15 07:57 PM, Timothy Groves wrote: How exactly are instantiated classes treated in an array? Can I copy one into another? And if I unallocate an array member, does it automatically Destroy the object? I have objects stored in a dynamic array, and I want to delete an arbitrary recor