Static constructors guaranteed to run?

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Jul 1 00:55:20 PDT 2015


On Mon, 29 Jun 2015 17:22:17 +0000, Marc Schütz wrote:

> On Monday, 29 June 2015 at 11:36:42 UTC, ketmar wrote:
>> it doesn't, afair, but it's quite natural. if user type was throwed out
>> as unused, it would be very strange to insist on keeping it's
>> initialization code.
> 
> Yes, but I would instead expect that the static ctor prevents the type
> from becoming unused in the first place.

and i expect it to be thrown away. ;-) as we have module-scope static 
ctors to initialize various things that should be always initialized. and 
type static ctor -- by my logic deduction -- should only initialize 
internal type fields. and why should i even bother to initialize that 
internal fields if the type is not used anywhere?
-------------- 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/20150701/07ba0e7b/attachment.sig>


More information about the Digitalmars-d-learn mailing list