Why are globals set to tls by default? and why is fast code ugly by default?

Guillaume Piolat first.last at spam.org
Sat Apr 1 13:11:46 UTC 2023


On Friday, 31 March 2023 at 19:43:42 UTC, bachmeier wrote:
>
> Those of us that have been scarred by reading FORTRAN 77 code 
> would disagree. I use global mutables myself (and even the 
> occasional goto), but if anything, it should be 
> `__GLOBAL_MUTABLE_VARIABLE` to increase the pain of using them.

But you kind of get into the same things with "accidental TLS". 
It doesn't race, but now the variable is different for every 
thread, which is a different kind of race.

TLS could be explicit and we wouldn't need a -vtls flag. There is 
no flag to warn for every use of @trusted, so in the grand scheme 
of things TLS is more dangerous than @trusted.


More information about the Digitalmars-d-learn mailing list