Setting array length to 0 discards reserved allocation?

Jesse Phillips via Digitalmars-d digitalmars-d at puremagic.com
Mon Jul 28 11:13:16 PDT 2014


On Sunday, 27 July 2014 at 18:52:55 UTC, Andrew Godfrey wrote:
> Now:
>
> int[] i = new int[5];
>
> For now let's call 'i' a "dynamic array" and the thing it 
> refers to
> a "foobar".

'i' is a "dynamic array" and contains a reference to a "block of 
memory."

Frankly I don't see how making the distinction at 'dynamic array' 
and 'slice' will help with the particular confusion. For example, 
in Go a slice stomps memory:

http://he-the-great.livejournal.com/48672.html


More information about the Digitalmars-d mailing list