Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!sei.cmu.edu!fs7.ece.cmu.edu!o.gp.cs.cmu.edu!pt.cs.cmu.edu!henry.ece.cmu.edu!hairston From: hairston@henry.ece.cmu.edu (David Hairston) Newsgroups: comp.sys.mac.programmer Subject: Re: How to best do a linked list on Mac Message-ID: <13358@pt.cs.cmu.edu> Date: 10 Jun 91 15:37:33 GMT References: <1991Jun10.002416.5656@gn.ecn.purdue.edu> <1561@caslon.cs.arizona.edu> Organization: Gaia II Lines: 34 [jess@gn.ecn.purdue.edu (Jess M Holle) writes:] [] I now need to implement a linked list on the Mac (or similar structure) and [] would really appreciate a summary of the posts back then if somebody has [] one still. [jtgorman@cs.arizona.edu (J. Taggart Gorman) writes:] [] Hey mark me down on this list, too. I have been avoiding dynamically [] allocated structures in my game I'm working on like the plague. [] [] Is the solution a Handle, ie.. [] [] dataStruct **dataHandle; there is no "the solution"! it depends!! however there is no substitute for understanding the issues involved (i'm not trying to be arrogant, just helpful)!!! in many cases, a dynamic linked list should be implemented as (unlocked) handles with the handles data containing a handle to the next element. this lets the memory manager take care of keeping the list "out of the way". in some cases, handles are too slow (i.e. double dereference) and in other cases you want to have better control over your heap allocation so you go with pointers. using pointers requires more attention to detail on your part so that you avoid heap fragmentation, if that is a problem to you, and so on. the best solution is whatever is most appropriate in your case. btw, the Memory Manager chapters in Inside Mac should be of some assistance in this matter. -dave- hairston@henry.ece.cmu.edu