Re: "GString" vs. "gstring".



On Sat, Jul 01, 2000 at 07:03:08AM -0400, David Wheeler wrote:
> The type names of "gstring" and "GString" are, uhm, rather similar :-).
> This seems confusing; it certainly makes them harder to talk about.
> 
> I'd like to see one of these type names changed so that their names
> differ by more than case.  Aliases could be created for the original
> names of types & functions, so no code would need to break.
> The "old" name could be deprecated & removed several years hence.

Wow,
	It appears to me that "gstring" is simply a typedef for gchar*
and absolutely nothing more.  This calls to mind Xt and other fun
things.  I dislike this indirection anyway, as it only hides the array
nature of C strings.  Frankly, if it's just a C string (and not a more
complex type like GString) the user should see just gchar*.  I can't
tell you how many types I double-taked seeing String* in Xt code.
Compare these two function prototypes:

g_str_do_something(gstring foo, gstring *foo_return);

g_str_do_something(gchar *foo, gchar **foo_return);

	Were a gstring an opaque-ish type (ala GString), the first one
makes sense.  But as it is not, the second prototype is _far_ clearer
to the C programmer (IMHO).
	Given the name conflict, I'd just remove "gstring".

Joel

-- 

Life's Little Instruction Book #69

	"Whistle"

                                  jlbec@evilplan.org
                                  http://zenII.uk.linux.org/~jlbec/




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]