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: Obscure iostream failure, a compiler bug or a language design issue?


On 05/15/2014 09:58 AM, Ulrich Windl wrote:

I guess the problem is that constructors are called sequentially without dependency analysis. So if d() is acaaled before including iostream (lexically), the program crashes.

Yes, that's right. The C++ mechanism for initialization of global variables is fairly primitive. I'm not sure if GCC can do much about that because it's more or less what programmers expect, and more reliable mechanisms would have a performance impact (as long as dynamic linking with independent recompilation is supported).

(By the way, such questions are more appropriate for the gcc-help mailing list.)

--
Florian Weimer / Red Hat Product Security Team


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