@system blocks and safer @trusted (ST) functions
Walter Bright
newshound2 at digitalmars.com
Sun Jul 25 12:01:01 UTC 2021
On 7/25/2021 1:16 AM, Bruce Carneal wrote:
> He was the one who recommended that I
> pursue this DIP at beerconf (it was just an idea that I'd thrown out up to that
> point).
That's right. I did not think of the case of removing the @system block from a
@trusted function and then silently losing the safety checking in the rest of
the @trusted function. Thanks for pointing it out.
One solution would be for the compiler to check such @trusted functions for
@safe-ty anyway, and issue an error for @trusted functions with no @system{}
blocks and no @safe errors.
The user could silence this error by adding an empty @system block:
@system { }
More information about the Digitalmars-d
mailing list