Path: utzoo!attcan!uunet!unisoft!hoptoad!tim From: tim@hoptoad.uucp (Tim Maroney) Newsgroups: comp.sys.mac.programmer Subject: Re: serious code generation bug in Lightspeed C Message-ID: <6327@hoptoad.uucp> Date: 17 Jan 89 07:44:20 GMT References: <6275@hoptoad.uucp> <1676@helios.ee.lbl.gov> <6315@hoptoad.uucp> <1532@cps3xx.UUCP> Reply-To: tim@hoptoad.UUCP (Tim Maroney) Organization: Eclectic Software, San Francisco Lines: 31 In article <1532@cps3xx.UUCP> rang@cpswh.cps.msu.edu (Anton Rang) writes: > Well, maybe not *well* documented, but documented at least. From >Inside Mac, volume II, page 16: > > The Lisa Pascal compiler frequently dereferences handles during > its normal operation. You should take care to write code that > will protect you when the compiler dereferences handles in the > following cases: Yes, but that starts with "The Lisa Pascal compiler". There is nothing documented about this being a problem with C. In fact, since this section started with a mention of the WITH statement, I assumed that all it was talking about was Pascal. There's no Apple documentation that this is a problem in C -- and that includes the MPW C documentation. Nor does THINK document it with reference to LSC, though someone says they did in previous editions of the manual. > aHandle^^.field := NewHandle(...) > > A problem may arise because the compiler generates code that > dereferences the handle before calling NewHandle--and NewHandle > may move the block containing the field. Notice again that this is phrased in compiler-specific language. As it happens, it also applies to C compilers and other Pascal compilers, but that's not how things read. -- Tim Maroney, Consultant, Eclectic Software, sun!hoptoad!tim "I've got troubles of my own, and you can't help me out. So take your meditations and your preparations and ram it up yer snout!" - Frank Zappa, "Kozmik Debris"