Why is &array[0] @safer than array.ptr?
David Nadlinger via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 25 14:46:10 PST 2017
On Tuesday, 24 January 2017 at 11:38:16 UTC, Jonathan M Davis
wrote:
> It seems _slightly_ better from a safety perspective but only
> slightly.
Wrong – one is correct, the other is not. This is because every
pointer in SafeD is dereferencable. Pointer arithmetic is not
allowed in SafeD, so your concerns about reading from other
memory do not apply.
— David
More information about the Digitalmars-d-learn
mailing list