Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!sol.ctr.columbia.edu!emory!att!pacbell.com!pacbell!osc!tma From: tma@osc.COM (Tim Atkins) Newsgroups: comp.lang.c++ Subject: Re: Smart pointers and stupid people (was: garbage collection...) Message-ID: <4173@osc.COM> Date: 26 Jan 91 08:16:53 GMT References: <3071@lupine.NCD.COM> <4114@osc.COM> <3342@lupine.NCD.COM> Reply-To: tma@osc.UUCP (Tim Atkins) Organization: Versant Object Technology, Menlo Park, CA Lines: 21 Responding to Ron Guilmete's post on limiting pointer bugs... This is a pretty interesting proposal but it seems to break down when object movement is allowed. I assume it is to be considered a bug if an object moves but a subsequent update goes to the old location of the object instead of the new one. Even with good encapsulation I'm not sure that you will get much joy in the situation that a smart pointer is dereferenced and stored by the C or object code generated in a register just before some other arbitrary function gets executed which results in a situation where the object moves. On return the code (much of which you did not write but was generated from your code by the compiler) will happily pick up the old address from the register and run some updating method on it. I don't really see how encapsulation helps you here. You can't just look at the classes methods but must also look at the probability that something they call will move "this" object before mutation occurs. Do you have a reasonable solution for dealing with this problem? It is a class of bug also that will happen only sporadically depending on the entire state of the process re the need for object movement. - Tim