Hi,

sounds like this falls under what Meyers describes in Item 4 of Effective C++
(3rd edition, p30)

"...the relative order of initialization of non-local static objects defined in
different translation units is undefined."

Singletons provide a mechanism to control that order.

-- mew



Chris Hanson wrote:
> Robert Osfield wrote:
...
>> Would could just remove this code, as it was originally written to
>> catch usage of the OSG during the period that I added support for
>> multitexturing, helping users spot usage that was no longer valid.
>> However, this might just get you over this hurdle and on to the next
>> one.. static initialization may well be a wider problem.
> 
> 
>   Exactly my thinking.
> 
>>  In this
>> instance perhaps using a static method getTextureGLModeSet() would a
>> may of ensuring that it get constructed on first use in a similiar way
>> to way the singletons work.
> 
> 
>   I confess, I am a little perplexed by the problem. Could someone with
> maybe a wider knowledge of the static initialization situation explain
> to me what exactly is going on, and how an object can come into being
> without being properly constructed?
> 
>   I strongly suspect this is just the tip of an ugly iceberg. :(
_______________________________________________
osg-users mailing list
[email protected]
http://openscenegraph.net/mailman/listinfo/osg-users
http://www.openscenegraph.org/

Reply via email to