private static object construction bug?

Joe Buehler jbuehler@hekimian.com
Mon Aug 5 10:32:00 GMT 2002


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.

Joe Buehler



More information about the Gcc mailing list