[Issue 18375] std.getopt uses deprecated rwm operations for shared variables

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Feb 5 17:23:25 UTC 2018


https://issues.dlang.org/show_bug.cgi?id=18375

ZombineDev <petar.p.kirov at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |petar.p.kirov at gmail.com

--- Comment #2 from ZombineDev <petar.p.kirov at gmail.com> ---
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.

--


More information about the Digitalmars-d-bugs mailing list