[gnutls-devel] Casting from int to (void *)

Stef Walter stefw at gnome.org
Thu Feb 7 21:43:06 CET 2013


On 02/07/2013 07:06 PM, Nikos Mavrogiannopoulos wrote:
> On 02/07/2013 03:10 PM, Jaak Ristioja wrote:
> 
>> The current solution probably works for most x86 setups, but not for
>> all. The compiler warning is completely reasonable, as it points out
>> something which might not work properly on some platforms.
>> I suspect this behavior can't be corrected without breaking the ABI/API.
>> I think stuff with actual (void *) pointers still works if the
>> respective callbacks are properly set.
> 
> 
> Hello,
>  I by change to the ABI you mean adding a new function, that's not a
> high cost.
> 
> However, my main concern is whether there is an actual system where the
> current approach causes a problem in order to justify any action (at
> least from my part, if you submit a patch for that, that's another story).

FWIW, Glib has has macros for putting ints into pointers, and taking
them back out:

GUINT_TO_POINTER
GPOINTER_TO_UINT
GINT_TO_POINTER
GPOINTER_TO_INT

I mention this because I believe the general consensus is that there is
no relevant platform for which you can't store 32-bits of integer in a
pointer.

Cheers,

Stef




More information about the Gnutls-devel mailing list