Discussion Thread: DIP 1028--Make @safe the Default--Final Review

Jonathan M Davis newsgroup.d at jmdavisprog.com
Thu Mar 26 07:30:20 UTC 2020


On Thursday, March 26, 2020 12:49:25 AM MDT Kagamin via Digitalmars-d wrote:
> On Thursday, 26 March 2020 at 05:43:41 UTC, Walter Bright wrote:
> > https://github.com/dlang/druntime/blob/master/src/core/stdc/limits.d#L29
> >
> > declares everything as @trusted, yet should be @safe. It isn't
> > technically broken, but it isn't right.
>
> That one should be @system, like any other C header. @safe is
> supposed to be checked by the compiler, so C headers can't
> possibly have @safe declarations.

Really, the issue with that particular module is that it contains no
function declarations whatsoever, making any kind of @safety attribute
utterly pointless. Either way, I agree that @safe makes no sense for
extern(C) declarations of any kind. @trusted can make sense but not @safe.
Unfortunately though, it _is_ currently legal to mark non-extern(D) function
declarations with @safe even though the compiler isn't verifying anything.

- Jonathan M Davis





More information about the Digitalmars-d mailing list