This is the mail archive of the
mailing list for the GCC project.
Re: private static object construction bug?
- From: Joe Buehler <jbuehler at hekimian dot com>
- To: Joe Buck <Joe dot Buck at synopsys dot com>
- Cc: joseph dot buehler at spirentcom dot com, gcc at gcc dot gnu dot org
- Date: Mon, 05 Aug 2002 13:32:11 -0400
- Subject: Re: private static object construction bug?
- Organization: Spirent Communications
- References: <200208051648.JAA22947@atrus.synopsys.com>
- Reply-to: joseph dot buehler at spirentcom dot com
Joe Buck wrote:
Sorry, but the version of "thread-safe" that you are asking for would
require substantially slower code: you appear to want thread-safe locking
for the creation of all objects (in your case, for the construction of
a static variable that is local to a function). GCC is never going to do
that. The speed penalty would be enormous.
OK, thanks, that's what I wanted to know. I had assumed that all globals
were constructed before main() enters, but apparently C++ is not defined
that way for all types of globals.