[OffTopic] A vulnerability postmortem on Network Security Services

Nick Treleaven nick at geany.org
Wed Dec 8 17:27:51 UTC 2021


On Thursday, 2 December 2021 at 20:51:56 UTC, Paul Backus wrote:
>     extern(C) void sayHello() // @system by default
>     {
>         writeln("Hello!");
>     }
>
>     void main() // @safe by default
>     {
>         sayHello();
>         // Error: @safe function `main` cannot call @system 
> function `sayHello`
>     }

extern(C) with a function body should be @safe by default too, 
because the compiler knows the function is implemented in D. 
extern(C) without a function body should be @system by default, 
because the compiler has no idea what language the function is 
written in. So the above code would not error.


More information about the Digitalmars-d mailing list