Re: GLib: embedded list implementation?

On Thu, 2007-11-29 at 10:30 -0500, Jeff Garzik wrote:
> Greetings from pre-2000 GLib contributor :)


> The Linux kernel has a unique, and useful, doubly-linked list 
> implementation that I find myself constantly copying into the userspace 
> programs that I write.  As a frequent user of GLib in my console-based 
> and server applications, I thought it would be nice to have included in 
> GLib proper, and wanted to solicit the opinions of current developers.

When I first came around GLib I wanted to propose the same...  Basically
the current GLib lists and the kernel-style lists are two different
things.  They have completely different uses and purposes.

The GLib lists implement the list data structure, so you can create
lists of objects, whatever objects they are, that you have.  Think
Python lists.

Kernel lists on the other hand are designed to implement structures that
have the shape of a chain (or multiple chains for that matter).  That
is, the list is a property of the object.  Though conceptually it may
not be the case and objects may be implemented like that just for
optimization.  They are indeed useful, but for different uses.

I personally find the kernel-style list idea very cool, but the syntax
to use them very weird and unnatural in C.  I used to be a great fan of
syntactic sugar in C using macros and what not, but GLib has taught me
that staying with the standard idioms and syntax is good, and I now


"Those who would give up Essential Liberty to purchase a little
 Temporary Safety, deserve neither Liberty nor Safety."
        -- Benjamin Franklin, 1759

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