can we un-deprecate .ptr on arrays in @safe code? cf issue 18529

Dukc ajieskola at gmail.com
Wed Feb 28 22:34:07 UTC 2018


I don't think a just iterated array is automatically set to null, 
so taking it's pointer won't hit a memory-proteted area. So 
undeprectating arr.ptr in @safe would break @safety and be a step 
backward.

If this is an issue, one can define a @trusted function which 
takes a starting pointer from array and casts it to size_t before 
returning it so memory corruption cannot happen via it.

On Tuesday, 27 February 2018 at 09:47:51 UTC, Stefan Koch wrote:
> Checking if an array is the slice of another.

For that there is also std.array.overlap().




More information about the Digitalmars-d mailing list