order of static constructor execution

Walter Bright newshound1 at digitalmars.com
Mon Mar 15 11:52:15 PDT 2010


Regan Heath wrote:
> Walter Bright wrote:
>> Regan Heath wrote:
>>> Walter Bright wrote:
>>>> Regan Heath wrote:
>>>>> I expect this either isn't possible or falls into the 'possible up 
>>>>> to a point' category.
>>>>
>>>>
>>>> It's possible up to a point, that point being the parts of the 
>>>> program the compiler does not see.
>>>
>>> So.. isn't that the same point the current import dependency method 
>>> stops at?
>>
>> No, because that's a runtime check.
> 
> No, I'm no longer suggesting a runtime solution.
> 
> How does 'unreachable code' detection in C/C++ compilers work?

It requires the source code so the compiler can look at it.

> Can you use something similar to figure out the order module static data is used?

Yes, but that fails when the compiler doesn't have the source code to look at.



More information about the Digitalmars-d mailing list