Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!cmcl2!lanl!lanl.gov!egw%weaks From: egw%weaks@lanl.gov (Eric Wasserman) Newsgroups: comp.sys.mac.programmer Subject: Re: Think C Objects in motion??? Message-ID: <63234@lanl.gov> Date: 18 Sep 90 01:23:17 GMT Sender: news@lanl.gov Organization: LANL Lines: 22 References:<1990Sep14.105646.23614@cunixf.cc.columbia.edu> <6988@dog.ee.lbl.gov> In article <6988@dog.ee.lbl.gov> beard@ux5.lbl.gov (Patrick C Beard) writes: With regard to objects in Think C: > 2. Objects are handles, not pointers, and therefore have to be treated > with kindness. The rule is, don't assign into an object's fields if > the rhs of the assignment can move memory. Actually this is not the case in which instance variables are a problem. Page 192 of the Think C manual states: "It is OK to assign values to instance variables, even when the expression on the right hand side may move memory." In Think C the rhs is evaluated first (including any memory shuffling) and THEN the handle reference on the lhs is evaluated. The real problem is passing the address of an instance variable to a routine which may move memory. There is an example of this in the same page in the Think C manual. I hope this helps. Eric Wasserman