digitalmars.D.learn - __gshared on structs
- Simen kjaeraas (8/8) Aug 14 2010 __gshared struct foo {
- Trass3r (3/3) Aug 14 2010 I don't think that this syntax is supported at all.
- Simen kjaeraas (6/9) Aug 15 2010 Hence my asking 'Why is this not an error?'.
- Bernard Helyer (7/8) Aug 20 2010 Because DMD ignores invalid attributes, and almost never flags them as a...
- bearophile (5/7) Aug 20 2010 Vote this:
__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
Aug 14 2010
I don't think that this syntax is supported at all. You need to use __gshared with the instance instead: __gshared foo f;
Aug 14 2010
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
Aug 15 2010
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
Aug 20 2010
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
Aug 20 2010