On Saturday, 13 May 2017 at 00:59:14 UTC, Stanislav Blinov wrote:
On Saturday, 13 May 2017 at 00:36:55 UTC, mogu wrote:
```d
if (null)
"1".writeln;
if ("")
"2".writeln;
if ("" == null)
"3".writeln;
```
Output:
2
3
How to understand this?
Boolean conversion on an array works on array's pointer, not
it's length. So even though `"".length == 0`, `"".ptr != null`,
and so `cast(bool)"" == true`.
However
if ([])
"1".writeln;
prints nothing.
So why does "" has non-null pointer while [] has null pointer?
Looks inconsistent.