Topic: static object construction/destruction ord


Author: ball@eng.sun.com (Mike Ball)
Date: 1996/06/19
Raw View
In article 639C@smtp.svl.trw.com, Greg Silverman <greg_silverman@smtp.svl.trw.com> writes:
> The ARM says that static objects in a translation unit are constructed
> in the order their definitions appear in the file and that destructors
> are called in reverse order. I did the following experiment on Solaris
> 2.5 using Sun's version 4.1 compiler:
>
> Thus, in a global sense, the objects were not destructed in reverse of the
> order in which they were constructed. Is this correct C++?

The Sun compile obeyed the FILO (or is that FCLD) rule only within a compilation
unit.  This is a known bug that we elected not to fix because there was no way
that a "conforming" (using that term very loosly) program could tell about it and
because we fully expected some clarification by the Committee.

That clarification has now arrived, and we will change the runtime accordingly.

In the meantime, don't use the compiler's behavior in this area to indicate
anything at all about the standard.

---
Michael Ball
SunSoft Development Products
---
[ comp.std.c++ is moderated.  To submit articles: Try just posting with your
                newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  Comments? mailto:std-c++-request@ncar.ucar.edu
]