Path: utzoo!utgpu!utstat!jarvis.csri.toronto.edu!rutgers!att!cbnewsm!stanl From: stanl@cbnewsm.ATT.COM (stanley.b.lippman) Newsgroups: comp.lang.c++ Subject: hp exit c++ static destructors Message-ID: <6422@cbnewsm.ATT.COM> Date: 10 Nov 89 15:31:12 GMT Organization: AT&T Bell Laboratories Lines: 32 >>peter@media-lab.media.mit.edu >> I just found that without the explicit call to exit() the destructors >> never get called. Hence the outputstream just disappears (if I put >> a flush in the main() without using exit() at least it prints, but >> still does not call any destructors). Is that supposed to be so? >> I have no idea where to look as to what went wrong. Any hints? *** this behavior of the HP9000 series is discussed in the paper ``C++: From Research to Practice'' by myself and Barbara Moo, p. 127 in the 1988 Usenix C++ Conference Proceedings. the problem, in a nutshell (or kernel) is that cfront provides its own instance of exit in libC.a. this instance insures the execution of static destructors. the CC command presumes that the call cc myFoo.c libC.a libc.a will link in the first encountered instance of exit. however, unless the user's code has an explicit call of exit, the binding of exit to the libc.a instance is done outside the conventional binding rules. i'm not familiar enough with the hp line to provide any insight into its behavior. stan lippman at&t bell laboratories warren, nj