GString functions
- From: Jamie Guinan <guinan bluebutton com>
- To: <gtk-list gnome org>
- Subject: GString functions
- Date: Mon, 17 Mar 2003 19:10:20 -0500 (EST)
I'm looking at
http://developer.gnome.org/doc/API/2.0/glib/glib-Strings.html
where many of the GString functions return "GString *".
I understand that the ".str" member of a GString can change across
g_string_*() calls, but are there any guarantees about the returned
GString itself?
If given this,
s = g_string_new("redhat");
s = g_string_append(s, ".com");
is it safe to throw away the result of the _append(), as in,
s = g_string_new("redhat");
g_string_append(s, ".com");
?
The GString API has a distinctly lisp-ish feel, which tends to make me use
it in a lisp-like manner, but if I don't need to, I'd like to know.
I took a brief look at glib/gstring.c, and I *think* I'm Ok, but I thought
it would be good to ask here.
The lisp-ish API makes sense to me for the GLib string utility functions
(g_str*) where there is no separate storage, but I'm aiming to use
GString.
Actually, I wouldn't mind a GObject-based string class so I could track
GString and GObject references all together, but that would introduce a
3rd set of string operations to the G* family, and I don't see any use of
GObject classes in GLib (even though they're in the same tarball). Just
thinking out loud...
Thanks,
-Jamie
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]