Setting array length to 0 discards reserved allocation?

ketmar via Digitalmars-d digitalmars-d at puremagic.com
Sun Aug 17 00:35:41 PDT 2014


On Sun, 17 Aug 2014 10:32:51 +0300
ketmar via Digitalmars-d <digitalmars-d at puremagic.com> wrote:

sorry, i meant THIS code:
 
   void foo (int[] a) {
     a ~= 42;
   }
   ...
   int[] arr;
   arr ~= 666;
   foo(arr);
   assert(arr.length == 2 && arr[1] == 42);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140817/8306e5ab/attachment.sig>


More information about the Digitalmars-d mailing list