Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!samsung!think.com!hsdndev!husc6!endor!siegel From: siegel@endor.uucp (Rich Siegel) Newsgroups: comp.sys.mac.programmer Subject: Re: Another THINK Pascal gotcha - "With" instance vars Message-ID: <5479@husc6.harvard.edu> Date: 26 Jan 91 01:58:52 GMT References: <1991Jan25.233122.2825@fennel.cc.uwa.oz.au> Sender: news@husc6.harvard.edu Reply-To: siegel@endor.UUCP (Rich Siegel) Organization: Symantec Language Products Group Lines: 30 In article <1991Jan25.233122.2825@fennel.cc.uwa.oz.au> a_dent@fennel.cc.uwa.oz.au writes: >I found another way to crash Think Object Pascal applications!!! > >In the manual, they warn against passing instance variables by reference, as >they may move by the time the called routine returns. This is a very easy trap >to fall into, despite the warning. > >They DIDN'T extend the warning to cover the "with" statement. Sorry. :-) I'll see that it gets into the doc. Also, calling New( ) for an instance variable is a good way to crash, since it involves taking the address of the instance variable. This will be fixed in the next version of the compiler... >I suspect that the THINK environment does a lot of locking of objects behind >the scenes so this one probably also qualifies as a "only crashes compiled >applications" scenario. In fact, the debugger does absolutely nothing "behind the scenes"; crashes like this are usually purely random. R. Rich Siegel Symantec Languages Group Internet: siegel@endor.harvard.edu "...she's dressed in yellow, she says 'Hello, come sit next to me, you fine fellow..."