[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: linked list library
From: |
John Darrington |
Subject: |
Re: linked list library |
Date: |
Sat, 1 Jul 2006 16:21:16 +0800 |
User-agent: |
Mutt/1.5.4i |
On Fri, Jun 30, 2006 at 11:13:57PM -0700, Ben Pfaff wrote:
Occasionally, it is invaluable, so it is a good macro to be aware
of.
I've seen it used before, but wasn't aware it was in the std. Now
that I know, I'll remember it.
> 4. It might be useful to have a const version of ll[x]_apply.
I was hesitant even to include ll[x]_apply. I am not sure it is
actually useful, because it is normally so much more convenient
to write an explicit loop instead of writing a separate function
to do what you want and then calling ll[x]_apply. But a const
version, to my mind, would be even less useful, because it would
only be useful if it could communicate back to the caller or if
it modified static data. The former is inconvenient (you have to
use the void * "aux" parameter) and the latter is inelegant at
best.
What do you think?
Let's leave it until it proves itself necessary.
> 5. How about an assertion to ensure the requirement that
> llx_set_allocator is called before any other llx_ function ?
The allocation routines were an afterthought, and I think that
the concept is wrong. Some lists will want to be allocated on
the heap, some from pools, some possibly from custom allocators.
So for the revised version I introduced a "memory manager" type,
and the routines that allocate or release nodes take a memory
manager argument.
I posted the revised library in the patch:
http://savannah.gnu.org/patch/download.php?file_id=10286
Seems fine to me.
J'
--
PGP Public key ID: 1024D/2DE827B3
fingerprint = 8797 A26D 0854 2EAB 0285 A290 8A67 719C 2DE8 27B3
See http://pgp.mit.edu or any PGP keyserver for public key.
pgpXrEgtUmbMT.pgp
Description: PGP signature