Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!tut.cis.ohio-state.edu!brutus.cs.uiuc.edu!apple!usc!polyslo!ttwang From: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Newsgroups: comp.lang.c++ Subject: Re: copy objects to another location Message-ID: <14285@polyslo.CalPoly.EDU> Date: 11 Sep 89 17:48:18 GMT Reply-To: ttwang@polyslo.CalPoly.EDU (Thomas Wang) Distribution: usa Organization: Cal Poly State University -- San Luis Obispo Lines: 22 It is my impression that memcpy() work OK if the following things do not happen: 1) The object to be moved does not contain physical pointers to itself. 2) The object to be moved does not contain physical pointers to other objects which could be moved. These two requirements can be met in principle. However there are nastier problems. If you are in the middle of an object's member function, and that object gets moved, then 'this' will be pointing to the wrong place. To solve this problem, you would either have to lock an object, or have the ability to modify the value of 'this' to point to the correct place. It does seem that 'copying garbage collection' is too much a hassle to implement in C++. I think I will stick to not moving any objects. -Thomas Wang (Ranma no baka! - Ranma 1/2 ) ttwang@polyslo.calpoly.edu