Static constructors in structs.
TheFlyingFiddle via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Oct 30 15:10:58 PDT 2015
On Friday, 30 October 2015 at 21:29:22 UTC, BBasile wrote:
> __gshared is mostly usefull on fields (eg public uint a)
> because it prevents a data to be put on the TLS, which in
> certain case reduces the perfs up to 30%. The byte code using a
> global variable that's not __gshared can be incredibly slower !
I have gotten used to using __gshared on fields so much that I
just naturally assumed that shared static this() { } would be
equivalent to __gshared static this() { } :P. I find they can be
very useful for data that initialized in static constructors and
then never change again (I will have to fix my shared
constructors now :S guess i have been lucky not running into race
problems before).
More information about the Digitalmars-d-learn
mailing list