Yet another leak in the sinking ship of @safe

Nick Treleaven via Digitalmars-d digitalmars-d at puremagic.com
Tue Feb 23 03:04:31 PST 2016


On Friday, 19 February 2016 at 19:00:35 UTC, H. S. Teoh wrote:
> Here's an existing one that plugs another hole in the cheese 
> grater:
>
> 	https://github.com/D-Programming-Language/phobos/pull/4009

That pull mentions the issue of *arr[$..$].ptr being unsafe:

https://issues.dlang.org/show_bug.cgi?id=11176

Assuming we don't want to disallow slice.ptr in @safe code, maybe 
we could have the compiler insert this code before reading 
slice.ptr:

version(D_NoBoundsChecks) else
     if (slice.length == 0) throw new RangeError("Unsafe .ptr on 
empty array");


More information about the Digitalmars-d mailing list