Re: GtkLabel trouble #2
- From: Esteban Quijano Vincenzi <equijano videotek tv>
- To: gtk-list gnome org
- Subject: Re: GtkLabel trouble #2
- Date: Sun, 13 May 2001 12:49:54 -0600
So, is it fair doing something like this?
gchar *text;
text = GTK_LABEL(label_widget)->label;
Esteban Q.
(I know we should access all data members by its interface, and not directly)
Helmethead wrote:
> On Sat, May 12, 2001 at 11:57:23AM -0600, Esteban Quijano Vincenzi wrote:
> > I thinkk we should consider an important porting issue in here.
> > GTK will always work with gchar instead of char because we don´t know if
> > gchar will be equal to char in the future.
>
> I think the C spec says chars are always 1 byte.
>
> > So, I think it's better to use gchar with something like this:
> >
> > gchar *text;
> >
> > text = (gchar *)calloc(1, sizeof(gchar));
> > gtk_label_get(GTK_LABEL(label_pointer), text);
>
> This is another way of doing it that doesn't work (if gtk_label_get works as this thread has indicated, anyway, I'm not familiar with it).
> First even the compiler will bitch because text is a gchar* and gtk_label_get wants a gchar**
> Second, passing &text won't work properly either. If text is an array, you'll get a compiler error since gtk_label_get will try to assign a new pointer value to it, which is illegal. If text is a pointer holding calloc()ed memory, that memory will leak because gtk_label_get will assign it's own block of memory to text :).
>
> ain't pointers grand
>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]