G
Giorgos Keramidas
| There are nice macros for singly-linked lists, doubly-linked lists and
| tail-queues in BSD and Linux. A tail-queue can serve as a very nice
| LIFO if you wrap it in code of your own to insert elements at the head
| and remove them from the tail (or vice versa).
|
| Have a look at /usr/include/sys/queue.h in FreeBSD and Linux.
|
| It's often a good idea to *avoid* reimplementing a particular wheel,
| especially if there is a possibility for amusing ``corners'' (bugs,
| limitations, or lack of features) in the new wheel reimplementation
OTOH, it can be good to reimplement when the new one fixes bugs in the
legacy implementation.
Heh, good point
The queue.h implementation does not protect against multiple
evaluation of arguments. I have code that does. The tradeoff is that
my code is not as widely tested (that's what you get with any new
code). In fact, these are not even officially released. So of course
I'd like to see it tested more widely. You can preview (and even use)
them here.
The linked list macro collection by itself:
http://phil.ipal.org/pre-release/list-0.0.6/list.h
The linked list macro collection in a larger collection:
http://phil.ipal.org/pre-release/dropinc-0.0.0/misc/list.i
These are now licensed under the BSD-like license used by OpenBSD.
Excellent! I'll have a look and thank you for releasing the code under
a BSD-friendly license.