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

ag0aep6g anonymous at example.com
Thu Mar 26 16:56:52 UTC 2020


On 26.03.20 17:02, Atila Neves wrote:
> I do however understand why one would want to say that an 
> external C library has no @safe interface. But that can be done by 
> applying @system manually. I'm not sure what the best solution is.

Applying @system manually is fine, as long as the compiler reminds you 
to do it with an error. Otherwise, the DIP that makes @safe the default 
will end up weakening @safe.

Today, this rightfully fails compilation:

----
extern (C) void* memcpy(void* dst, const void* src, size_t n);

int main() @safe
{
     auto x = new int;
     auto y = new int(13);
     immutable r = new int(0);
     memcpy(x, y, 100);
     return *r;
}
----

With DIP 1028 in its current state, it passes.

I think that's unacceptable. As far as I see, that's the majority 
opinion. Hopefully, you and/or Walter can agree and avoid accepting a 
DIP with a "fatal flaw" (as Steven put it).


More information about the Digitalmars-d mailing list