Static constructors in structs.

Adam D. Ruppe via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Oct 30 13:59:41 PDT 2015


On Friday, 30 October 2015 at 20:23:45 UTC, TheFlyingFiddle wrote:
> I just noticed this works in 2.069, is this intended?

I thought it always worked. The __gshared there I'm pretty sure 
doesn't do anything and should prolly be removed.

The two forms are `static this` which is called for each thread 
and `shared static this` which is only called once per process. 
The compiler literally looks for the sequence of keywords there, 
so they need to be exactly in that order.

But yeah, the struct feature table http://dlang.org/struct.html 
shows them as checked.


More information about the Digitalmars-d-learn mailing list