[futurebasic] Re: Linked Lists

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : September 1998 : Group Archive : Group : All Groups

From: "Edwards, Waverly" <WEdwards@...>
Date: Wed, 30 Sep 1998 17:22:30 -0400
EXCERPT FROM RICK BROWN
	
	I too usually find an XREF@ array to suit my needs better; but
there are
	certain things that make linked lists preferable at times.
Besides the
	issue of variable-size records (which I hadn't even thought
about),
	there's this:

	[SECTION SNIPPED FOR SAKE OF SPACE]

	2) Big blockmoves may not be a problem for your fast computer,
but there
	may be situations where you _must not_ slide the items around in
memory:
	for example, suppose you have some external pointer which points
to item
	#17.  Then suppose you need to insert a new item into slot #5 as
above. 
	You cannot slide items around to make room for the new item, for
then
	your pointer to item #17 no longer points to the right place.
The
	linked list of windows in the MacOS is a perfect example of
this.  Once
	a window is created, its record _cannot_ be moved in memory,
because
	applications depend on it staying in one spot.  The only way to
keep it
	"stationary" and yet allow other windows to be inserted and
deleted at
	arbitrary positions within the list, is to use a linked list.

I'm feeling a little dense.  Hopefully someone can tell me why I would
want to use pointers for anything, especially a linked list.

I've been programming for years and have only used pointers when IM
stated that it must be used for a toolbox call.  The only benefit I can
see in using a pointer would be that I don't have to spend time locking
and unlocking it.  Outside of this it seems to be a detriment.  If you
don't allocate your pointers at the beginning of your program then you
end up fragmenting memory.  I say this based on this supposition:   The
intent of using a pointer is to permanently allocate memory during the
entire life of the program.

Feeling kinda dense and hoping someone would enLIGHTen me.


W.