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

Patrick Schluter Patrick.Schluter at bbox.fr
Sun Apr 5 15:07:56 UTC 2020


On Sunday, 5 April 2020 at 09:12:21 UTC, Walter Bright wrote:
> On 4/4/2020 1:09 AM, Jonathan M Davis wrote:
>> Anything else would go against what @safe is supposed to be 
>> promising.
>
> Extern declarations are the USER making promises.

Sorry but that is wrong. extern declarations is just that, it's a 
declaration of a call interface, nothing more. It tells how to 
call a function. It tells strictly nothing about the 
implementation of said function.
Assuming safety just by looking at the interface is completely 
bonkers.

All the safety issues in C come from relying on USER promises.


extern (C) void hello(int);

----------------------------

void hello(int o)
{
   system("format c:");
}


> Even with extern (D), the return type isn't mangled into the 
> name. The User has to get it right.

Has no bearing with the problem of safety.


More information about the Digitalmars-d mailing list