-
-
Notifications
You must be signed in to change notification settings - Fork 609
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
disallow __gshared members without static #18877
Labels
Comments
ketmar commented on 2014-09-04T11:32:18Zafter some thinking i started to believe that we should make exactly the opposite: warn about 'static __gshared' members. '__gshared' implies "one instance", so 'static __gshared' is excessive and meaningless. |
ketmar commented on 2014-09-04T13:27:33ZCreated attachment 1413
warns on "static __gshared" variables
something like this, heh |
ketmar commented on 2014-09-04T13:28:19ZCreated attachment 1414
druntime code cleanup |
ketmar commented on 2014-09-04T13:28:42ZCreated attachment 1415
phobos code cleanup |
schuetzm commented on 2014-09-04T18:37:02Z`static __gshared` is currently indeed redundant, but my point is that this isn't obvious. I would expect it to work analogously to a shared member: You can have static and non-static ones of those. As I see it, __gshared merely means "make it shared, but don't complain about unsynchronized access".
Therefore I can't agree that it implies "one instance". It's IMO better to make it explicit. |
ketmar commented on 2014-09-04T19:43:04Zspecs clearly says:
> __gshared may also be applied to member variables and local variables.
> In these cases, __gshared is equivalent to static, except that the
> variable is shared by all threads rather than being thread local.
http://dlang.org/attribute.html#gshared
so "static __gshared" is a tautology, and i believe that it should be error instead of warning. but error'ing it can break some code, so let's warn for now. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Marc Schütz (@schuetzm) reported this on 2014-09-04T09:50:42Z
Transferred from https://issues.dlang.org/show_bug.cgi?id=13421
CC List
Description
!!!There are attachements in the bugzilla issue that have not been copied over!!!
The text was updated successfully, but these errors were encountered: