You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
All of these examples should *never* compile. The whole point of `shared` is to statically disallow accidental access shared mutable state. > 90% of all functions in phobos have no business touching `shared`/`__gshared` variables, especially `std.getopt`.
`std.getopt` can be safely used to set:
* function local variables
* (static) thread-local variables
* immutable global variables from shared static constructors (not sure if this currently works, but it should be ok from memory model perspective)
I consider everything else to potentially trigger undefined behavior.
> immutable global variables from shared static constructors (not sure if this currently works, but it should be ok from memory model perspective)
No this doesn't work at the moment.
For future readers: it has been used by people before (https://github.com/vibe-d/vibe.d/pull/2060).
Seb reported this on 2018-02-05T12:57:36Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=18375
CC List
Description
The text was updated successfully, but these errors were encountered: