Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!uw-beaver!uw-june!sullivan From: sullivan@june.cs.washington.edu (Kevin Sullivan) Newsgroups: comp.lang.c++ Subject: need garbage collection Message-ID: <7255@june.cs.washington.edu> Date: 12 Feb 89 22:17:51 GMT Organization: U of Washington, Computer Science, Seattle Lines: 33 We (a group of 5) are about to implement a fairly substantial system in C++. A couple of us have been working for several days now trying to devise a (preprocessing) scheme that will convert ordinary C++ classes into garbage collected classes. Our approach has been to process a class declaration into two new declarations, one containing the body of the user defined class plus a reference count, and the other, having the name of the class the user declared, containing a pointer to an instance of the former. The idea was that all member class instances would become, in effect, pointers to heap-based instances. The assignment operator on these "wrapper" classes would then be programmed to maintain the reference counts on assignment. Unfortunately we have had very little success. The idea seems simple, but all of the designs that we have tried so far have interacted very poorly with aspects of C++, with everything from "this" being passed implicitly to protected members in the inheritance hierarchy being made inaccessible by the separation of one class into two. Have any others solved a problem related to this one? Any pointers? Thanks a lot. -Kevin Sullivan Department of Computer Science University of Washington Seattle, WA. -- -------- Kevin Sullivan, sullivan@cs.washington.edu, Department of Computer Science, Sieg Hall FR-35, University of Washington, Seattle, WA 98195 (206) 543-1695