On 2/27/18 12:32 PM, Atila Neves wrote:

There's a common case where it's not equivalent - when the pointer is null. Imagine I have a C function I want to call:

extern(C) void fun(int* things);

Imagine also that it's ok to call with null. Well, now I can't use a slice to call this and have it be 1) @safe and 2) not throw RangeError. I ran into this the other way.

fun(x.length ? &x[0] : null);

I think even the compiler could elide the bounds check since you already did it, but I'm not sure that actually happens.

-Steve

Reply via email to