Re: compilation warnings on DEC alpha platform



> Just a quick note to say that I see numerous warnings in both gnome and gtk
> code of the form
> warning: casts pointer to integer of different size
> and vice versa. This is due to void* and int being 8 and 4 bytes respectively
> on the DEC alpha (running linux at least). Execution, if these warnings are
> ignored, is fraught! Arithmetic traps galore and unaligned accesses galore!
> Oh yes!

all that's needed is to cast ints to long on alpha ... I have written some
macros to do that ... they might be usefull for these cases ... maybe put
in glib.h ???? ... or gnome.h ???

/*a few macros to reduce compiler warnings*/
#if (SIZEOF_INT == SIZEOF_VOID_P)
#	define PTOI(p) (gint)((gpointer)p)
#	define ITOP(i) (gpointer)((gint)i)
#elif (SIZEOF_LONG == SIZEOF_VOID_P)
#	define PTOI(p) (glong)((gpointer)p)
#	define ITOP(i) (gpointer)((glong)i)
/*I doubt there is a such a platform, but why not*/
#elif (SIZEOF_SHORT == SIZEOF_VOID_P)
#	define PTOI(p) (gshort)((gpointer)p)
#	define ITOP(i) (gpointer)((gshort)i)
#endif

then use these macros as casts

George

-- 
------------------------------------------------------------------------------
George Lebl <jirka@5z.com> http://www.5z.com/jirka/
------------------------------------------------------------------------------
  The following implements RSA in perl and is illegal to export from the US:

          #!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj
          $/=unpack('H*',$_);$_=`echo 16dio\U$k"SK$/SM$n\EsN0p[lN*1
          lK[d2%Sa2/d0$^Ixp"|dc`;s/\W//g;$_=pack('H*',/((..)*)$/)



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