I've an function which takes one argument(object) and return some
string(gchar *).
Becouse it's getting read-only propertis[1]) it shouldn't be the same
as in object.
Should I:
- Always allocate new gchar * and mark it as gchar *object_get(const
Object *) G_GNUC_MALLOC;
- Keep gchar * inside and mark it as const gchar *object_get(const
Object *) G_GNUC_PURE;
- Always allocate new gchar * and mark it as gchar *object_get(const
Object *) G_GNUC_MALLOC G_GNUC_PURE;

I'm not quite sure, but I think second is dangerous (if user cast it
into gchar and for example free it).
Thirt, I think, could allocate more strings then will be released.

Am I right?

[1] I'd like to double: getting by properties and functions.
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to