[gnutls-devel] Casting from int to (void *)
Nikos Mavrogiannopoulos
nmav at gnutls.org
Thu Feb 7 09:34:13 CET 2013
On Tue, Feb 5, 2013 at 5:23 PM, Jaak Ristioja <jaak.ristioja at cyber.ee> wrote:
> Hello!
> According to the documentation GnuTLS functions like
> gnutls_transport_set_ptr can also be used for berkeley style sockets
> descriptors, but unfortunately converting between int and void * types
> is not always good thing to do:
Hello,
What we actually need is for the compiler to be able to do (int->ptr)
and then (ptr->int) in a way that no information is lost (i.e., the
last int will be the same as the first). The current approach is, if
the callbacks are set, then the provided pointer is passed to them,
and if not, the transport pointer is casted to an integer and provided
to send(). If there was an issue a function like you describe could be
used and the the value to a union, but is it really needed? Do you
think there will be systems where the current behavior will not be
tolerated? (such a set_berkeley function would solve the warning issue
though)
regards,
Nikos
More information about the Gnutls-devel
mailing list