Re: [gtk-list] Re: z80 Assembly IDE



On Thu, 11 Nov 1999, Matthew D Allen wrote:

> You could use linked lists, but isn't that kind of overkill?  Say you
> wanted to keep track of the widgets corresponding to the different pages,
> or structures of your own that contain the widgets and the filenames and
> so on.  Just put a ceiling on the number of files they can have open at a
> time.  Like, choosing an arbitrary number, say, 32.  If you know somebody
> who likes to edit more than 32 files simultaenously, increase it.  :)

There's no reason to put an arbitary limit.  I am assuming you are using
gtk, in which case you have access to glib without any memory penalty.
If you need random access to elements of the list, you use g_slist_nth().
Don't put an arbitary limit on the user.  Limits should reflect external
restrictions, not lazy programming. 

> That way, you always have the info, and a straight index into the array,
> which is quicker than searching through a linked list for an object.
> (Although with the number of things you're probably working with the speed
> difference would be negligible.)

Exactly, so with the convienience functions provided by glib, there is
absolutely no reason to use an array, and good reasons to use a list.
This is bad advice.

Chris, you are using glib aren't you!?

Andrae Muys

--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Andrae Muys <andrae@humbug.org.au> "Never ascribe to malice that which is
System Programmer                   adequately explained by incompetence."
The Centre for Magnetic Resonance                   -Napoleon Bonaparte
The University of Queensland





[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]