arr.ptr, @safe and void*
Nick Treleaven via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Wed Jun 15 03:32:59 PDT 2016
Hi,
Walter's made a fix for arr[$..$].ptr being unsafe to dereference
- .ptr will be @system:
https://github.com/dlang/dmd/pull/5860
A referenced druntime pull mentioned having a safe wrapper for
.ptr that allows comparison of the pointer value, but does not
allow dereference. The wrapper would return uintptr_t (an integer
guaranteed to be big enough to hold a pointer value).
My question is: would returning void* instead really be unsafe,
i.e. is there a way of dereferencing it in safe code? (I'm not
thinking about holes in @safe, but ways by design).
More information about the Digitalmars-d-learn
mailing list