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 `false`. This could be useful when you want to distinguish 'no array' and an empty array.

For example:
```
int[] getList(); // might fail

void main() {
  if (auto list = getList) {
    writeln(list); // could be an empty list
  } else {
    error("could not retrieve list"); // must be 'null' list
  }
}
```


Reply via email to