[omniORB] Omni_mutex and static global object

Visscher, Bruce VISSCHB at RJRT.com
Wed Sep 15 20:14:05 BST 2004


Actually, you are right that modern C++ compilers don't have some of the
problems that they once did when it comes to static initialization.

I was probably overstating the case.  But I did say "problems and
disappointments".  Some remain.

One disappointment is that compilers can and do optimize away side
effects that some idioms used to rely on.

There is another problem that really is impossible to solve and that
is the order of initialization of global static objects between
translation units.  This is what goes to the problem that started this
thread.  In fact, I know: sometimes we do have to worry about things
like running from within a DLL when we don't have control over the main
program.  Or worse: the program was written in a language other than
C++.  In which case we might have to initialize a static pointer to 0
and initialize the ORB iff it is 0 (static initiliztion to binary
zero occurs before all other initialization so this is safe).  But then
deactivation is another can of worms...Yes, it is solvable but it might
not be as easy as you think it will be at first.

> I wrote:
> [...]*mumble*mumble*problems and disappointments*mumble*mumble*

:-)

> 
> renny.koshy at rubixinfotech.com wrote:
> > I agree... static initializers have haunted projects that I've come
> > into or been involved with as far back as I can remember.
> 
> Modern C++ compilers don't seem to have this problem. I regularly use
> GNU/g++, Sun/CC, IBM/xlC, DEC/cxx and HP/aCC and I have never once had
> trouble with static initialisers.
> 
> Can anyone name a modern C++ compiler that actually exhibits this
> problem?
> 
> -Alex
> 
> -- 
> :: alex tingle
> :: 58 kings way, harrow, mddx. uk. HA1 1XU
> :: alex.tingle AT firetree.net  +44-7901-552763 
> 
> _______________________________________________
> omniORB-list mailing list
> omniORB-list at omniorb-support.com
> http://www.omniorb-support.com/mailman/listinfo/omniorb-list
> 

-----------------------------------------
CONFIDENTIALITY NOTE:  This e-mail message, including any  attachment(s),
contains information that may be confidential,  protected by the attorney-
client or other legal privileges, and/or  proprietary non-public
information.  If you are not an intended  recipient of this message or an
authorized assistant to an intended  recipient, please notify the sender by
replying to this message and  then delete it from your system.  Use,
dissemination, distribution,  or reproduction of this message and/or any of
its attachments (if  any) by unintended recipients is not authorized and
may be unlawful.




More information about the omniORB-list mailing list