Path: utzoo!attcan!uunet!mcsun!hp4nl!tuegate.tue.nl!rc6.urc.tue.nl!rw8.urc.tue.nl! From: rcbaab@rw8.urc.tue.nl (Annard Brouwer) Newsgroups: comp.sys.mac.programmer Subject: Re: Linked Lists: Handles or Pointers? Message-ID: <.664719435@rw8.urc.tue.nl> Date: 24 Jan 91 12:17:15 GMT References: <1991Jan23.002212.7648@umiami.ir.miami.edu> Sender: USENET News System Reply-To: rcbaab@urc.tue.nl Lines: 33 rg2c+@andrew.cmu.edu (Robert Nelson Gasch) writes: >user Mondo@umiami.ir.miami.ed writes: >>If you want to create a linked list, do you have to: >> a) Use a handle to the head node only and use pointers >> for the rest of the list (Problem we see: the Memory >> Manager will compact the heap and make all those ptrs invalid.) >> or >> ... >I'm no expert on the subject, but here's my response: >I'm not sure what the problem is. I Started programming in C a year ago >and translated my linked list routines from Pascal without any problems. >They use pointers only, no handles. If there's an issue of Mac programming >I'm missing, please alert me, but I don't see any reason why a linked list >should have to use handles. Even the head you can just malloc() and free(), >so I see nothing that would require the use of handles. It's quite simple, depending on the size of your linked list the speedup you get by using handles is significant, plus the memory manager can move smaller clumps of memory around which might help you when memory is getting tight. It's not that difficult to do but please do not use calls like MoveHHi() and HLock() and HUnlock(). They have given me lot's of problems and so I don't use them anymore... Good luck! Annard. -- | Annard Brouwer Bitnet : rcgbbaab@heitue51 | Dreef 74 UUCP : rcbaab@urc.tue.nl | NL-5504 LD Veldhoven packet-radio : pe1koo@pi8mid | The Netherlands [44.137.28.6]