[OffTopic] A vulnerability postmortem on Network Security Services

Paul Backus snarwin at gmail.com
Thu Dec 2 20:51:56 UTC 2021


On Thursday, 2 December 2021 at 20:36:46 UTC, Greg Strong wrote:
> On Thursday, 2 December 2021 at 17:36:18 UTC, H. S. Teoh wrote:
>> The solution is very simple: extern(C), extern(C++), and 
>> extern anything
>> except extern(D) really, should be @system, and extern(D) (the 
>> default)
>> should be @safe.
>>
>> The real issue is convincing Walter to accept this.
>
> Yes - this seems like the most reasonable solution to me.  I 
> don't see why it would be particularly controversial.

The last time this came up, Walter's argument against it was 
(iirc) that having two separate defaults for different kinds of 
functions is much worse for usability than having one universal 
default.

It's worth keeping in mind that extern(C) does not necessarily 
mean "written in C". So applying this rule as written would lead 
to some rather confusing edge cases; for example:

     import std.stdio;

     extern(C) void sayHello() // @system by default
     {
         writeln("Hello!");
     }

     void main() // @safe by default
     {
         sayHello();
         // Error: @safe function `main` cannot call @system 
function `sayHello`
     }


More information about the Digitalmars-d mailing list