Re: GType <=> gpointer
- From: Manish Singh <yosh gimp org>
- To: Ross McFarland <rwmcfa1 neces com>
- Cc: gtk-devel-list gnome org
- Subject: Re: GType <=> gpointer
- Date: Tue, 3 Feb 2004 08:34:41 -0800
On Tue, Feb 03, 2004 at 08:23:58AM -0500, Ross McFarland wrote:
> On Tue, 2004-02-03 at 03:28, Manish Singh wrote:
> > Uhm, those casts aren't really correct on x86_64 either (though it will
> > work in most cases). type = (GType) pointer should work just fine. How
> > did you come to the conclusion it was required?
>
> compiler warnings on x86_64 were complaining about implicit type casts
> and such. and in a few places x86 had and we'd done incorrect casts that
> caused a problem or two, if i'm not mistaken.
The following compiles warning free on x86_64:
#include <gtk/gtk.h>
int
main (void)
{
GHashTable *h;
GType type1, type2;
g_type_init ();
h = g_hash_table_new (g_str_hash, g_str_equal);
type1 = gtk_box_get_type ();
g_hash_table_insert (h, "Box", (gpointer) type1);
type2 = (GType) g_hash_table_lookup (h, "Box");
g_print ("Type: %s\n", g_type_name (type2));
return 0;
}
And gives the correct output when run:
Type: GtkBox
So the wrong usage of GUINT_TO_POINTER doesn't solve anything.
-Yosh
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]