Quick question regarding dynamic array deletions

WhatMeWorry kheaser at gmail.com
Sun Sep 1 18:26:20 UTC 2019


int[] a = [ 3, 7, 9 ];

1) a = [];
and
2) a = null;

sets both the .ptr property of the array to null, and the length 
to 0.

whereas

3) a.length = 0;

just sets the length to 0.


If all the above is correct, does this mean we should just stick 
to either of the first two forms and never use 3).  Maybe my 
question is when would be want to use 3) without also adjusting 
the .ptr ?




More information about the Digitalmars-d-learn mailing list