Re: Quick question regarding dynamic array deletions

2019-09-01 Thread Jonathan M Davis via Digitalmars-d-learn
On Sunday, September 1, 2019 12:42:54 PM MDT Dennis via Digitalmars-d-learn wrote: > On Sunday, 1 September 2019 at 18:26:20 UTC, WhatMeWorry wrote: > > Maybe my question is when would be want to use 3) without also > > adjusting the .ptr ? > > It matters when casting to a boolean, since an empty

Re: Quick question regarding dynamic array deletions

2019-09-01 Thread Dennis via Digitalmars-d-learn
On Sunday, 1 September 2019 at 18:26:20 UTC, WhatMeWorry wrote: Maybe my question is when would be want to use 3) without also adjusting the .ptr ? It matters when casting to a boolean, since an empty array with a non-null pointer is still `true` while an array with null pointer casts to

Quick question regarding dynamic array deletions

2019-09-01 Thread WhatMeWorry via Digitalmars-d-learn
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