Why are globals set to tls by default? and why is fast code ugly by default?
Richard (Rikki) Andrew Cattermole
richard at cattermole.co.nz
Sun Mar 26 18:25:54 UTC 2023
Having TLS by default is actually quite desirable if you like your code
to be safe without having to do anything extra.
As soon as you go into global to the process memory, you are responsible
for synchronization. Ensuring that the state is what you want it to be.
Keep in mind that threads didn't exist when C was created. They could
not change their approach without breaking everyone's code. So what they
do is totally irrelevant unless its 1980.
I think its the correct way around. You can't accidentally cause memory
safety issues. You must explicitly opt-into the ability to mess up your
programs state.
More information about the Digitalmars-d-learn
mailing list