Re: gtk_label_get_text() string duping
- From: Federico Mena Quintero <federico helixcode com>
- To: Tim Janik <timj gtk org>
- Cc: Gtk+ Developers <gtk-devel-list gnome org>
- Subject: Re: gtk_label_get_text() string duping
- Date: 28 Jun 2000 00:03:56 -0400
Tim Janik <timj@gtk.org> writes:
> a) a function returning a reference should be the normal getter
> interface of an object. so say oyu have an object foo, that
> holds a string gchar *bar; you provide an accessor:
> gchar* foo_get_bar (Foo *foo) { return foo->bar; }
> (we don't enforce "const" in return values for a variety
> of reasons that have been discussed before. if we did,
> this function would return const gchar*)
I know you hate me, Tim, but such a function should return a const
char *. That way it becomes obvious from looking at the function
prototype that you should not touch the returned value.
IMNSHO the GNOME Programming Guidelines got this right.
As Owen pointed out this has issues with threading, but hey, what the
hell :-)
Federico
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]