Static initialization order

BCS none at anon.com
Sun Feb 7 20:08:49 PST 2010


Hello Justin,
> Yes, well, that unfortunately is what I'm doing in my C++ project ..
> putting implementation of all the static class declarations in one
> big file.

could you do that same sort of things that you do with .h files?


void SomeStaticInitFunction()
{
   static bool once = false, done = false;
   if(once) { assert(done); return; }
   once = true;

   // call the StaticInitFunctions that you depend on:

   done = true;

   // do other stuff.  
}

and then call the StaticInitFunctions whenever and wherever you want.

--
<IXOYE><





More information about the Digitalmars-d mailing list