Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!yale!mintaka!proton!andru From: andru@proton.lcs.mit.edu (Andrew Myers) Newsgroups: comp.lang.c++ Subject: Re: Are global class objects special? Message-ID: <1990Oct4.212120.2266@mintaka.lcs.mit.edu> Date: 4 Oct 90 21:21:20 GMT References: <28241@pasteur.Berkeley.EDU> <1990Oct2.162451.3101@Neon.Stanford.EDU> <11427@alice.att.com> Sender: daemon@mintaka.lcs.mit.edu (Lucifer Maleficius) Organization: MIT Laboratory for Computer Science Lines: 16 In article <11427@alice.att.com> ark@alice.att.com (Andrew Koenig) writes: >In article <1990Oct2.162451.3101@Neon.Stanford.EDU>, hall@eclipse.stanford.edu (Keith Hall) writes: > >> Having the constructors called in the proper order seems so >> fundamental that I don't understand why that behavior is not already >> ensured by the compiler/linker. > >What is the proper order? How can a compiler determine what >that order is? With a small amount of work, it's possible to create a class which orders global constructors (and other operations to be performed before main) based on a dependency graph. Similarly, the same technique can be used to unwind the process and do ordered global destruction, if desired. Andrew