dynamic array .length vs .reserve - what's the difference?
    ag0aep6g 
    anonymous at example.com
       
    Fri Jul 31 10:00:26 UTC 2020
    
    
  
On 31.07.20 01:42, wjoe wrote:
> I could swear just a few weeks ago there was someone asking how to tell 
> if an array was null or of length 0 and an answer was that it's the same 
> and can't be distinguished so I assumed that assigning a slice of 0 
> length is the same as setting the array to null because the result is 
> the same as a 0 length array.
This one?
https://forum.dlang.org/thread/xgnbzpziqmjyjfsqlzfi@forum.dlang.org
`[]` is the same as `null`.
While `b[0 .. 0]` is empty like `[]`, it is not the same (unless `b` is 
already `[]`/`null`). The `.ptr`s are different.
    
    
More information about the Digitalmars-d-learn
mailing list