This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: private static object construction bug?


> 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.

But you didn't have a global, you had a static variable that is local to a
function.  The rule for such objects is different.




Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]