Static constructors guaranteed to run?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Jun 28 19:07:57 PDT 2015


On Sat, 27 Jun 2015 22:49:13 +0000, Tofu Ninja wrote:

> On Saturday, 27 June 2015 at 22:20:40 UTC, ketmar wrote:
>> 2. no.
> 
> Hmm...  any reason why?

if instantiated template was not used in any code that makes into 
compiled binary, compiler is free to remove it with all it's ctors. it 
may do that, or may not, but removal is allowed. so while that can work 
now (i didn't checked), it may stop working in next version (or with 
another compiler), and that will not be a bug.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20150629/82c5b44b/attachment.sig>


More information about the Digitalmars-d-learn mailing list