Thread overview | |||||||
---|---|---|---|---|---|---|---|
|
August 14, 2010 __gshared on structs | ||||
---|---|---|---|---|
| ||||
__gshared struct foo {
int n;
}
foo f;
This f is not shared between threads, even though the
__gshared indicates it should be. Why is this not an error?
--
Simen
|
August 14, 2010 Re: __gshared on structs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen kjaeraas | I don't think that this syntax is supported at all. You need to use __gshared with the instance instead: __gshared foo f; |
August 15, 2010 Re: __gshared on structs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Trass3r | Trass3r <un@known.com> wrote: > I don't think that this syntax is supported at all. > You need to use __gshared with the instance instead: > __gshared foo f; Hence my asking 'Why is this not an error?'. However, shared struct foo {} works, so one might expect symmetry to dictate that __gshared might, too. -- Simen |
August 21, 2010 Re: __gshared on structs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Simen kjaeraas | On Sun, 15 Aug 2010 17:15:19 +0200, Simen kjaeraas wrote: > Hence my asking 'Why is this not an error?'. Because DMD ignores invalid attributes, and almost never flags them as an error (or even a warning!). `shared scope immutable import foo;` FWIW, I disagree with this behaviour -- SDC[1] will warn on no-op attributes. [1]:http://github.com/bhelyer/SDC |
August 21, 2010 Re: __gshared on structs | ||||
---|---|---|---|---|
| ||||
Posted in reply to Bernard Helyer | Bernard Helyer: > Because DMD ignores invalid attributes, and almost never flags them as an error (or even a warning!). Vote this: http://d.puremagic.com/issues/show_bug.cgi?id=3934 Bye, bearophile |
Copyright © 1999-2021 by the D Language Foundation