Re: [gtk-list] Re: How to use a gpointer?



On Wed, Mar 03, 1999 at 06:50:19PM -0800, Theodore Roth wrote:
> This looks kinda dangerous to me:
> 
> Lars Hallberg wrote:
> > > GTK_SIGNAL_FUNC(handle_value),(gpointer)???);
> >   GTK_SIGNAL_FUNC(handle_value),(gpointer) value);
> > >
> > > the_value=??????data;
> >   the_value= (int) data;
> 
> Correct me if I'm wrong, but doesn't this make the assumption that
> sizeof(int)==sizeof(void *)? And wouldn't this cause problems on systems
> which the assumption is false, e.g. 64 bit systems? I feel the safer way
> to do it is to pass the reference, as in (gpointer)&value.

You probably right (i got 0 64 bit experiens). Hovewer i think glib
promis some things to work (probably shuld use gint32 insted of int -
but that migt be problem on some 16 bit mashines ;-)

This in the start of main will make the problem menefest whenever there:

   if(sizeof(int)>sizeof(gpointer))
	exit();



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