@safe inference fundamentally broken

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Thu Jun 5 12:27:55 PDT 2014


On Thu, 05 Jun 2014 14:47:54 -0400, deadalnix <deadalnix at gmail.com> wrote:

> On Thursday, 5 June 2014 at 18:33:22 UTC, Timon Gehr wrote:
>> On 06/05/2014 08:17 PM, deadalnix wrote:
>>> @safe is fundamentally broken.
>>
>> What's the "fundamental" problem? The construct seems perfectly fit to  
>> specify memory safety in at least the following context:
>>
>> void main()@safe{}
>>
>> :o)
>
> Many constructs are assumed to be @safe on basis @safe don't
> guarantee.
>
> T[] arr = [ ... ];
> arr = arr[$ .. $];
> auto garbage = *(arr.ptr);

Believe it or not, this is actually safe.

-Steve


More information about the Digitalmars-d mailing list