Path: utzoo!utgpu!news-server.csri.toronto.edu!rpi!usc!snorkelwacker.mit.edu!bloom-beacon!eru!hagbard!sunic!mcsun!ukc!icdoc!syma!paulr From: paulr@syma.sussex.ac.uk (Paul Russell) Newsgroups: comp.sys.mac.programmer Subject: Unsafe use of an object field as a var or > 4 byte parameter Message-ID: <4749@syma.sussex.ac.uk> Date: 19 Mar 91 14:09:17 GMT Sender: paulr@syma.sussex.ac.uk Followup-To: comp.sys.mac.programmer Organization: University of Sussex Lines: 20 When passing a parameter such as a Str255 as a parameter to a method, where the parameter is also an object field, the MPW Pascal compiler complains: ### Pascal - Error 815 Unsafe use of an object field as a var or > 4 byte parameter I can understand why it might object to a VAR parameter being passed in this way, since that would in effect be dereferencing a handle. But why should it object when the parameter is not VAR ? For non-VAR parameters surely a local copy of the parameter is made before the called function has a chance to move memory ? Am I missing something here ? It's a real pain to have to keep making temporary copies of object fields before passing them to methods but I don't want to start putting {$H-} directives in the code unless I know it really is safe. (BTW - THINK Pascal doesn't care about this - does that mean that it handles the problem for you, or that it just ignores it ? ;-)) //Paul