memory safety checks and trust

Walter Bright newshound2 at digitalmars.com
Mon Apr 13 07:50:43 UTC 2020


On 4/11/2020 7:43 PM, Timon Gehr wrote:
> Clearly there is a bug or bad design if the address of a`` escaping in `b ~= &a` 
> and in `b = [&a]` are not treated the same.

They are treated the same with dip1000.

> But like Adam I don't see why there 
> should be such a check in @system/@trusted code at all. (I understand that there 
> is a workaround, but that should not be required.)
> 
> Can we please settle on making @safe actually memory safe and @system/@trusted 
> actually trust the programmer?

Consider:

   @system int* pumpkin(int i) { return &i);

Should that give an error or not?

I.e. where does one draw the line?



More information about the Digitalmars-d mailing list