Why is &array[0] @safer than array.ptr?
Kagamin via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jan 25 02:52:51 PST 2017
On Tuesday, 24 January 2017 at 12:01:35 UTC, Jonathan M Davis
wrote:
> So, while it makes sense to say that .ptr can't be used in
> @safe code, it really doesn't make sense to suggest &arr[0] as
> an alternative.
When you ensure pointers point to existing data, you can
dereference them in safe code, otherwise you can't.
More information about the Digitalmars-d-learn
mailing list