Re: [Fwd: Data in linked lists]
- From: "Eric M. Monsler" <emonsler beamreachnetworks com>
- To: Eric Lemings <eric b lemings lmco com>
- Cc: gtk-list gnome org
- Subject: Re: [Fwd: Data in linked lists]
- Date: Sat, 07 Jul 2001 15:44:40 -0700
Eric,
I am not sure whether you are suggesting that the pointers be constant
pointers, or that they be made pointers to constant data.
In either case, the only benefit that I see would be to catch at
compile-time bugs in the GList and GSList implementations; the
inadvertant altering of either the data pointer or its referenced data.
The downside would be enforcing a default policy on every application's
usage of GList or GSList. Yes, a simple cast allows the "const" policy
to be overridden, but that forces the cast to appear in every usage.
In addition, I that that this would cause perplexing and ugly code
constructs in the applications. For example, a function used with a
g_list_foreach() call would take as its argument a pointer to constant
data, and might then immediately cast that pointer to pointing at
non-constant data and begin manipulating it.
While those pointers could indeed use const without disturbing the GList
and GSList functionality, I feel that it would be a worse design;
causing more confusion and obtuse code for minimal benefit. I would
argue for the current scheme if this was a fresh implementation; the
mass breakage of existing GList and GSlist code that would result from
such a change seems to me to be an overwhelming argument against it.
Eric M. Monsler
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]