Tristan Van Berkom <[EMAIL PROTECTED]> wrote:

> Generally,
>      if a function takes `const gchar *' as an argument it just means
> that the said function garauntees that your string will not be modified
> by that function (whereas a `gchar *' argument is generally a return
> location for a single char).
> 
> Here are some examples in GTK+ that do use static strings:
> 
> http://developer.gnome.org/doc/API/2.0/gobject/gobject-Standard-Parameter-and-Value-Types.html#g-value-set-static-string
> http://developer.gnome.org/doc/API/2.0/glib/glib-Quarks.html#g-quark-from-static-string


Excellent.
So, I sum up:

a. If the programmer wants to make clear that a string argument of a
function is not changed internally she designs it as a const gchar*.

b. If the programmer wants to make clear that a function expects the
string pointer to not be changed outside she has to mark that by
additional keywords like "_from_static_string" in the function's name.


Felix
_______________________________________________
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