Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!purdue!tut.cis.ohio-state.edu!cs.utexas.edu!ginosko!usc!polyslo!ttwang From: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Newsgroups: comp.lang.c++ Subject: Re: multiple destructors Message-ID: <1989Oct22.220719.29822@polyslo.CalPoly.EDU> Date: 22 Oct 89 22:07:19 GMT References: <1989Sep30.190719.3340@polyslo.CalPoly.EDU> <6590273@hplsla.HP.COM> <1989Oct21.182759.13138@paris.ics.uci.edu> <10042@alice.UUCP> Reply-To: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Distribution: usa Organization: Cal Poly State University -- San Luis Obispo Lines: 37 bs@alice.UUCP (Bjarne Stroustrup) writes: >Ron Guilmette points out that by being clever you can deduce the storage >clas of an object from its address by knowing how your machine lays out >a program in memory. This is not only non-portable, but also unreliable >in the presense of a co-routine or lightweight process package because >these tend to have stacks in areas that to the simple single-thread layout >looks like free store. This is a good point. It seems there is no portable way in C++ to tell if an object is automatic, heap, or static. A related issue is the ability of C++ to support copying garbage collector. To directly support garbage collected objects in C++ will introduce overhead across the board. But it is possible to make C++ friendly toward copying garbage collector so that a 'class' implementation is possible. Two problems are 'this' pointers, and destructors. 'this' pointers are a major problem. There should be way to redefine 'this' to another data type, prodived the data type has '->' operator to reach the data members. A 'handle' on the stack can be maintained to point to the right place. A physical pointer on the stack is impossible to maintain. Destructors are a minor problem. There should be an easy way to tell if an object contains any destructors or not. Currently this problem can be solved by maintaining a virtual boolean function has_destructor(), but it's a tedious process. -Thomas Wang ("This is a fantastic comedy that Ataru and his wife Lum, an invader from space, cause excitement involving their neighbors." - from a badly translated Urusei Yatsura poster) ttwang@polyslo.calpoly.edu