Path: utzoo!utgpu!water!watmath!clyde!att!pacbell!lll-tis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!purdue!i.cc.purdue.edu!h.cc.purdue.edu!s.cc.purdue.edu!ags From: ags@s.cc.purdue.edu (Dave Seaman) Newsgroups: comp.sys.mac.programmer Subject: Re: Turbo Pascal - Am I Nuts? Message-ID: <3437@s.cc.purdue.edu> Date: 25 Jul 88 00:58:55 GMT References: <7536@cup.portal.com> Reply-To: ags@s.cc.purdue.edu.UUCP (Dave Seaman) Organization: Purdue University Lines: 40 In article <7536@cup.portal.com> Mike_G_Newman@cup.portal.com writes: >In 'How to Write Macintosh Software', Scott Knaster says that I >can do something like this: > > errCode := FSRead(fileRefNum,count,thisMemberHdl^); > >However, Borland's Turbo Pascal wants me to do this: > > errCode := FSRead(fileRefNum,count,@thisMember); > >Can someone explain this to me? Who's right? Are there other >problems with the Turbo compiler? I think you will find that both methods work just fine with Turbo. I assume your declarations are something like type aMemberHdl = ^aMemberPtr; aMemberPtr = ^aMember; aMember = ... something or other ... var thisMemberHdl : aMemberHdl; thisMember : aMember; so that the expressions ``thisMemberHdl^'' and ``@thisMember'' are both the same type (i.e. aMemberPtr) and therefore interchangeable so far as the rules of Pascal are concerned. The ``@'' sign in Turbo, unlike standard Pascal, is an ``address-of'' operator (similar to ``&'' in C). As long as you remembered to allocate the handle before the call, it should make no particular difference which way you do it. There is sometimes an advantage in allocating structures on the stack rather than the heap so as to avoid heap fragmentation. -- Dave Seaman ags@j.cc.purdue.edu