On Wednesday, 10 May 2017 at 11:12:06 UTC, Stefan Koch wrote:
On Wednesday, 10 May 2017 at 09:42:53 UTC, Timon Gehr wrote:
[...]

So here is the difference between null and []:

null :

() { Slice* s; s = null; return s; }

[] :
() { Slice* s; s = alloca(sizeof(*s)); s.base = null; s.length = 0; return s; }

Therefore

null.length => (cast(Slice*)null).length; which results in a segfault.

and

[].length => (cast(Slice*)somevalidSliceDiscriptor).length;

That's not how "regular" D works though.

Atila

Reply via email to