Why is &array[0] @safer than array.ptr?
David Nadlinger via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 25 14:44:37 PST 2017
On Tuesday, 24 January 2017 at 11:49:59 UTC, Atila Neves wrote:
> But it's still annoying to have to do &array[0] just to pass it
> to a C function, since `my_c_func(array.ptr)` isn't going to
> screw up anything.
How do you know it does not screw up anything? Presumably, the
function somehow accesses the object the pointer targets. How
would this be @safe to call if the pointer were not
dereferencable?
— David
More information about the Digitalmars-d-learn
mailing list