GTK+ FAQ
<<< Previous | Development with GTK+: general questions | Next >>>

# Shouldn't the text argument in the gtk_clist_* functions be declared const?

For example:

    gint gtk_clist_prepend (GtkCList *clist,
                            gchar    *text[]);

Answer: No, while a type "gchar*" (pointer to char) can automatically be cast into "const gchar*" (pointer to const char), this does not apply for "gchar *[]" (array of an unspecified number of pointers to char) into "const gchar *[]" (array of an unspecified number of pointers to const char).

The type qualifier "const" may be subject to automatic casting, but in the array case, it is not the array itself that needs the (const) qualified cast, but its members, thus changing the whole type.

<<< Previous | Home | Next >>>
How do I disable or enable a widget, such as a button? | Up | How do I render pixels (image data) to the screen?