Compiling phobos with -cov

Deewiant deewiant.doesnotlike.spam at gmail.com
Mon Jun 26 09:49:53 PDT 2006


kris wrote:
> -cov adds a static-ctor to each module compiled in that manner (IIRC),
> and thus exposes a runtime issue where any of the relevant modules have
> circular imports.
> 
> Probably the only realistic way to fix this is to break the circle.
> 

I don't see why this is such a problem. Circular construction might be, yes ---
each static constructor wanting to initialise something which needs the other
module. Then, the compiler cannot know which should be initialised first.

However, usually, couldn't the compiler just pick one module and run its
constructors first? If not, perhaps a feature could be added: the constructors
could have a parameter corresponding to their priority --- highest priority is
run first. The brackets in "static this()" are redundant as is, since there's
never anything to put in them, so might as well put a number there and have it
do something useful.

Or is there a deeper issue I'm ignorant of?



More information about the Digitalmars-d-learn mailing list