Re: g_list_prepend() vs g_list_append()
- From: Archit Baweja <bighead users sourceforge net>
- To: Mark Mielke <mark mark mielke cc>
- Cc: Chema Celorio <chema ximian com>, Jonathan Blandford <jrb redhat com>, gtk-devel-list gnome org
- Subject: Re: g_list_prepend() vs g_list_append()
- Date: 08 Sep 2002 22:01:52 -0500
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Mark Mielke <mark mark mielke cc> writes:
> On Sat, Sep 07, 2002 at 07:20:01PM -0500, Chema Celorio wrote:
> > GList is a very good linked list implementation. You are just having a
> > problem with the names, don't let the names fool you. If you want to do
> > efficient append then do:
> > ...
> > for (i = 0; i < 100; i++)
> > l = g_list_prepend (l, i);
> > l = g_list_reverse (l);
> > ...
> > That is what everybody does. With the very heavy use of glist out there
> > don't expect the implementation to change.
>
> The implementation wouldn't change. Your example above passed the first
> list element to g_list_prepend(), which is all quite normal.
>
> If "everybody does" g_list_prepend()/g_list_reverse(), would there be any
> resistance to the additional of a GCList or similar, that was a GList,
> except that it used g_clist_*() as methods, and was circular?
>
> Seems like solving the problem, rather than requiring everybody to use
> a workaround, might be prudent.
>
> g_list_reverse() may be fairly fast, but replacing:
>
>
> g_list_append(), ...;
>
> With:
>
> g_list_reverse();
> g_list_prepend(), ...;
> g_list_reverse();
Maybe we can implement g_list_append() as a macros which calls the 3 for us?
My 2 cents to the discussion...
Archit Baweja
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: Processed by Mailcrypt 3.5.6 and Gnu Privacy Guard <http://www.gnupg.org/>
iD8DBQE9fA8g2rWNPKmGjMcRAjc2AJ9Fce/zeF5aIyxW49dIgvwRcATqmgCeJXzw
VAtJtBaU+qi7MBP62aP31Qs=
=mEZs
-----END PGP SIGNATURE-----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]