simple question: are const gchar* arguments hold as copies internally?



Hi,

these two functions take const gchar pointers:

void gtk_label_set_text([...] const gchar *str);
void g_key_file_set_value([...] const gchar *group_name, [...])

Does that mean that the arguments are *not* hold as copies internally
so that I have to care for the allocated memory -- or can I savely pass
a temporary character string as an argument to the functions which make
a copy of the strings internally and also release their memory when
necessary automatically?

Below I copied the full description from the documentation.

Thank You

Felix




gtk_label_set_text ()

void        gtk_label_set_text              (GtkLabel *label,
                                             const gchar *str);

Sets the text within the GtkLabel widget. It overwrites any text that
was there before.

This will also clear any previously set mnemonic accelerators.

label :         a GtkLabel
str :   The text you want to set.



g_key_file_set_value ()

void        g_key_file_set_value            (GKeyFile *key_file,
                                             const gchar *group_name,
                                             const gchar *key,
                                             const gchar *value);

Associates a new value with key under group_name. If key cannot be
found then it is created. If group_name cannot be found then it is
created.

key_file :      a GKeyFile
group_name :    a group name
key :   a key
value :         a string



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]