@safe inference fundamentally broken

monarch_dodra via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 5 12:34:13 PDT 2014


On Thursday, 5 June 2014 at 19:27:56 UTC, Steven Schveighoffer 
wrote:
> On Thu, 05 Jun 2014 14:47:54 -0400, deadalnix
>> T[] arr = [ ... ];
>> arr = arr[$ .. $];
>> auto garbage = *(arr.ptr);
>
> Believe it or not, this is actually safe.
>
> -Steve

What do you mean by "is actually safe" ? In the "can you actually 
believe this obviously wrong code is marked as safe" or "this 
code that looks wrong is actually perfectly safe"?

AFAIK, it's only safe if arr is GC allocated to a bloc smaller 
than a page, so the conditions are implementation defined 
behavior, and so is the result.


More information about the Digitalmars-d mailing list