Both safe and wrong?

jmh530 john.michael.hall at gmail.com
Thu Feb 7 18:20:02 UTC 2019


On Thursday, 7 February 2019 at 17:33:01 UTC, Olivier FAURE wrote:
> [snip]
>
> One way to fix this would be to forbid using @system global 
> variables in @safe functions, but this would definitely be a 
> breaking change, unless global variable safety is determined by 
> the compiler by default (which is its own can of worms).

Inferring safety of global variables does seem tricky. You have 
to check every place it's used. I don't see what you could do 
other than forbid @system global variables in @safe functions. 
What your example shows is that it's broken already. At least 
adding the ability to mark them @safe is a step in making it 
possible to resolve the issue.


More information about the Digitalmars-d mailing list