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

ryuukk_ ryuukk.dev at gmail.com
Sun Mar 26 20:39:21 UTC 2023


On Sunday, 26 March 2023 at 18:29:17 UTC, Nick Treleaven wrote:
> On Sunday, 26 March 2023 at 18:07:03 UTC, ryuukk_ wrote:
>> What i find even more weird is writing fast code is ugly in D
>>
>> Look at this ugly code
>>
>> ```D
>> __gshared int fast_code_ugly;
>> ```
>
> Because it should be rare that __gshared is used. And if you 
> need it, you won't be worried about how the storage class looks 
> because you'll be concentrating on if your design is 
> thread-safe.
>


I don't understand this argument, if my code doesn't do threads, 
why should i put my variable into TLS?

If i want fast code, why should i make use of ugly syntax?


More information about the Digitalmars-d-learn mailing list