Static constructors guaranteed to run?
via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sat Jun 27 02:54:42 PDT 2015
On Friday, 26 June 2015 at 22:00:54 UTC, Tofu Ninja wrote:
> Are static constructors guaranteed to run if the module is
> imported?
AFAIK, yes.
> Also are static constructors in templated types guaranteed to
> run for every instantiation? Even if the instantiation is never
> actually used outside of compile time code, like in an alias or
> in a UDA?
Definitely not. Things inside a template don't even exist if that
template is never instantiated.
More information about the Digitalmars-d-learn
mailing list