Re: [PATCH][2.5] Single linked lists for Linux, overly complicated v2

Daniel Phillips (phillips@arcor.de)
Tue, 1 Oct 2002 18:05:15 +0200


On Monday 30 September 2002 22:04, Zach Brown wrote:
> but really, I think these are DOA.

No argument there.

> having to define a single magical
> structure member makes these more trouble than they're worth. I've come
> to prefer wli's 'struct list' approach. It has the added benefit of
> actually being sanely implementable with shared code, something
> ridiculously low memory setups might appreciate.

Have you tried it in a real program? I have. It's not nice to use.
My original response to Bill:

> > How's this look?
>
> Unfortunately, not good.  You get code like:
>
>         foo = (struct mylist *) slist_pop((slist *) &somelist->next);
>
> So type safety goes out the window, and you gain some niceness in the
> definition in exchange for ugliness in usage, the wrong tradeoff imho.

Single linked lists are so simple - just write the darn code out in
full. Yes, the fact that you can't sanely generalize these things shows
that C as a language falls a few cards short of a full deck, but we knew
that. It makes nice kernels, it does not make art.

-- 
Daniel

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/