Acess variable that was set by thread
ag0aep6g
anonymous at example.com
Mon Aug 8 14:54:15 UTC 2022
On Monday, 8 August 2022 at 14:29:43 UTC, Steven Schveighoffer
wrote:
> C has no notion of shared, so it's not the right type. Putting
> `shared` on it is kind of lying, and can lead to trouble.
> Better to be explicit about what it is.
Nonsense. Putting `shared` on a shared variable is not "lying".
It doesn't matter if C makes the distinction. D does.
> I'm not saying you should use `__gshared` liberally, or for
> cases where you are using this only in D. But to say you should
> *never* use it is incorrect.
If you're clever enough to identify a valid use case for
`__gshared` and write correct code with it, then you're clever
enough to figure out when not to listen to me.
Everyone else, don't ever use `__gshared` ever.
`__gshared` is about as bad as `-boundscheck=off`. They're both
glaring safety holes. But people want to be propper hackers (TM).
And propper hackers know how to handle these foot-guns, of
course. And then they shoot their feet off.
More information about the Digitalmars-d-learn
mailing list