Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!zaphod.mps.ohio-state.edu!pacific.mps.ohio-state.edu!linac!att!ucbvax!UCBVAX.BERKELEY.EDU!"Dan Karron From: Dan Karron@UCBVAX.BERKELEY.EDU Newsgroups: comp.sys.sgi Subject: realloc reactions ?? Message-ID: <9102150952.AA24219@karron.med.nyu.edu> Date: 15 Feb 91 09:52:03 GMT Sender: daemon@ucbvax.BERKELEY.EDU Reply-To: karron@cmcl2.nyu.edu Organization: The Internet Lines: 35 I am curious about the realloc function. Usually I build a linked list when you don't know how many elements of a table I need at the start of some operation. With realloc, you can grow the end of your table allocation block as you need the space, plus have the advantage of keeping all of the elements of your list in the form of an array. I think that this is really neat! This means that many applications that formerly were implimented as linked lists (single, or double,forward/backward linkages) can now be done as growable/shrinkable arrays. How does this work ? The documentation says that realloc'ed pointers can be moved by realloc, but I have tested the pointers on entry and exit and they never seem to move. Does realloc create holes in your heap ? Which way is the new preferred practice: linked lists or realloc'd arrays ? Cheers! Dan(who wants to unlink and array) +-----------------------------------------------------------------------------+ | karron@nyu.edu (E-mail alias that will always find me) | | Fax: 212 263 7190 * Dan Karron, Research Associate | | . . . . . . . . . . . . . . * New York University Medical Center | | 560 First Avenue \*\ Pager <1> (212) 397 9330 | | New York, New York 10016 \**\ <2> 10896 <3> | | (212) 263 5210 \***\_________________________________________ | | Main machine: karron.med.nyu.edu (128.122.135.3) IRIS 85GT | +-----------------------------------------------------------------------------+ NOTE PHONE NUMBER CHANGE: The Med Ctr has changed from 340 to 263 exchange.