On Saturday, 4 January 2014 at 04:20:30 UTC, David Nadlinger
wrote:
On Saturday, 4 January 2014 at 02:27:24 UTC, Kelet wrote:
While `@safe` helps reduce this class of logic errors […]
you can still have […] dangling pointers, hence it is
usually considered inferior with regards to safety.
This is not true. While it _is_ possible to get null pointers
in @safe code, they are not a safety problem, as the first page
is never mapped in any D processes (yes, I'm aware of the
subtle issues w.r.t. object size here, c.f. Bugzilla). And if
you find a way to obtain a dangling pointer in @safe code,
please report it to the bug tracker, this is not supposed to
happen.
Cheers,
David
There are many examples when one can get dangling pointer in
@safe code, they are fixed slowly, almost never (like slicing
static array - it was in bugzilla for some time and still not
fixed AFAIK, let alone other issues which received zero
response). By the way, asking to post such examples to bugzilla
contradicts idea that it is impossible to have such kind of code.
And being in bugzilla is not excuse for these bugs.