Re: Typecast error



CyborgHead netscape net wrote:
> gtk_signal_connect( GTK_OBJECT( robot_name[1] ), "clicked",
>         GTK_SIGNAL_FUNC( display_info ), 1 );
> 
> gui.h:873: cannot convert `int' to `void *' for argument `4' to
> `gtk_signal_connect (GtkObject *, const gchar *, void (*) (), void *)'

Hi Ciaran, there are two handy glib macros for this:

	void *GINT_TO_POINTER(int)
	int GPOINTER_TO_INT(void*)

They boil down to doing something like:

	void *a = (void *) 1;

but look out for any odd alignment/ordering problems for you, and are
much easier to read.

There are some other similar macros, grep through glibconfig.h.

HTH, John




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