Passing dynamic arrays

Pillsy pillsbury at gmail.com
Tue Nov 9 05:14:40 PST 2010


Steven Schveighoffer Wrote:

> On Mon, 08 Nov 2010 18:29:27 -0500, Ali Çehreli <acehreli at yahoo.com> wrote:
[...]
> > I must be remembering an old behavior. I think appending could
> > affect the original if it had enough capacity.

> Before the array append changes were introduced (somewhere around
> 2.040 I think?), appending to a slice that started at the beginning of
> the memory block could affect the other data in the array.  But that
> was a memory corruption issue, somewhat different than what we 
> are talking about.

Ah! This is a lot of what was confusing me about arrays; I still thought they had this behavior. The fact that they don't makes me a good deal more comfortable with them, though I still don't like the non-deterministic way that they may copy their elements or they may share structure after you append stuff to them.

Cheers,
Pillsy


More information about the Digitalmars-d mailing list