Re: g_list_prepend() vs g_list_append()



On Sun, Sep 08, 2002 at 01:17:13PM +0200, Soeren Sandmann wrote:
> James Henstridge <james daa com au> writes:
> > By the way, if you want to efficiently append to a GList, you should
> > maintain a tail pointer.  
> Or just use the GQueue data structure. GQueue is just a list and a
> tail pointer.

That must be updated by hand, which requires the caller to assume to know
exactly how a GQueue is internally implemented. If GQueue ever changed,
for example, if it became a circular list, any code that assumed to know
how to update GQueue state information, would be broken. Now, it might be
too late for this, as people may already do such things, but it doesn't
make it 'right'. :-)

mark

-- 
mark mielke cc/markm ncf ca/markm nortelnetworks com __________________________
.  .  _  ._  . .   .__    .  . ._. .__ .   . . .__  | Neighbourhood Coder
|\/| |_| |_| |/    |_     |\/|  |  |_  |   |/  |_   | 
|  | | | | \ | \   |__ .  |  | .|. |__ |__ | \ |__  | Ottawa, Ontario, Canada

  One ring to rule them all, one ring to find them, one ring to bring them all
                       and in the darkness bind them...

                           http://mark.mielke.cc/




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