@system blocks and safer @trusted (ST) functions

Paul Backus snarwin at gmail.com
Mon Jul 26 07:32:24 UTC 2021


On Monday, 26 July 2021 at 03:40:55 UTC, Timon Gehr wrote:
>
> The original claim was that the new feature is a tool that 
> allows the code base to be properly segregated more easily, not 
> that you can't still write incorrect @trusted code. If you have 
> to review @safe code to ensure memory safety of your @trusted 
> code, your @trusted code is incorrect.

@trusted code is correct if and only if it cannot possibly allow 
undefined behavior to be invoked in @safe code.

If my example is incorrect as-written, then you should be able to 
write a program that uses it, without modification, to cause 
undefined behavior in @safe code. Same for any given @trusted 
lambda.


More information about the Digitalmars-d mailing list