Passing dynamic arrays

Steven Schveighoffer schveiguy at yahoo.com
Tue Nov 9 04:33:38 PST 2010


On Mon, 08 Nov 2010 18:29:27 -0500, Ali Çehreli <acehreli at yahoo.com> wrote:

> Steven Schveighoffer wrote:
>
>  > No, it doesn't. If you are appending to data that was passed in, you  
> are
>  > not changing the *original data* passed in.  You are only appending  
> to it.
>
> 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.

-Steve


More information about the Digitalmars-d mailing list