[fpc-pascal] Arrays of objects

Adrian Maier adrian.maier at gmail.com
Wed Oct 31 13:38:30 CET 2007


On 10/31/07, Marco van de Voort <marcov at stack.nl> wrote:
> > On 10/31/07, Joao Morais <post at joaomorais.com.br> wrote:
> > > They are reference counted, just like ansi strings, ie don't worry about
> > > memory leakages.
> >
> > The detail that is not crystal clear to me is  :  after the first SetLength
> > and  i set the first 3  elements  ,   is it *guaranteed* that the
> > second SetLength
> > leaves those first 3 elements  untouched ?
>
> Yes. But they can be copied, so address to them might be invalid.
>
> > That's what i meant by "resize" as opposed to  "reallocate" . Reallocation
> > could occur in some other place in memory , leading to loosing the
> > original contents.
>
> It does resize if possible, reallocate (and copy the original data as far as
> it fits) else.

Thanks for the info!


-- 
Adrian Maier



More information about the fpc-pascal mailing list