Re: off topic question



  To further explain to myself what Scott said - the
gtk_file_selection_get_filename returns a pointer to a char array that is
not meant to be modifiable and is declared as a constant return value in the
library.

However, I have a follow-on question - isn't it the pointer itself that is
declared constant, not the character array that it points to?

And yes, I understand that may be a stupid question.

----- Original Message -----
From: "Scott Barron" <sb125499 ohiou edu>
To: <gtk-app-devel-list gnome org>
Sent: Friday, July 26, 2002 1:12 PM
Subject: Re: off topic question


On Fri, Jul 26, 2002 at 11:28:37AM -0500, Jeffrey Goddard wrote:
ok, i realize this is probably off topic, but can someone explain what
the
compiler is trying to tell me about these statements?

callbacks.c:27: warning: assignment discards qualifiers from pointer
target type

   gchar *filename;
   filename =
gtk_file_selection_get_filename(GTK_FILE_SELECTION(file_select_box));
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Hi,

gtk_file_selection_get_filename returns a const value and you're
assigning it to a non const value.  Try this:

const gchar *filename;
filename = gtk_file_selection_get_filename(....);

If you need to modify the filename, g_strdup() it.  Check the glib
manual under the standard macros section for an explanation of
G_CONST_RETURN.

-Scott

--
We are not humanity.
-B
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list




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