Path: utzoo!news-server.csri.toronto.edu!cs.utexas.edu!sun-barr!apple!netcom!sjsumcs!horstman From: horstman@mathcs.sjsu.edu (Cay Horstmann) Newsgroups: comp.lang.c++ Subject: Re: Smart pointers and stupid people (was: garbage collection...) Message-ID: <1991Mar3.201701.17707@mathcs.sjsu.edu> Date: 3 Mar 91 20:17:01 GMT References: <49285@apple.Apple.COM> <27C19834.162A@tct.uucp> <4186@lupine.NCD.COM> Organization: San Jose State University - Math/CS Dept. Lines: 27 In article <4186@lupine.NCD.COM> rfg@NCD.COM (Ron Guilmette) writes: > >I think that there may have been some misunderstanding regarding the true >meaning of my statement to the effect that C++ objects don't move. > >When I said that C++ objects don't move, I meant that they do not move >just like memory locations themselves do not move. Sure, you can copy >the *contents* of one location to another, but I have yet to see any (cute stuff deleted)> >Likewise, given some C++ code like: > > { > SOME_TYPE some_object; > > //... > //... > } > >I think that it is fairly clear that `some_object' resides in one (and only >one) place throughout its lifetime. That's true even if you copy its >*contents* into some other object. > In C, objects can move. A typical scenario is to malloc an array of structs (X* p = malloc( sizeof(X) * n )), fill it and later realloc. The same behavior occurs in a C++ variable array class. Cay