[Help-gnutls] Re: 64bit + gnutls_transport_set_ptr
jas at extundo.com
Sat Mar 18 15:54:11 CET 2006
Oliver Lupton <oliverlupton at gmail.com> writes:
> Is there any way I can avoid this compile warning on 64bit systems?
> gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) fd);
> Gives me:
> m_ssl_gnutls.cpp:260: warning: cast to pointer from integer of different
> I can see why...it's casting from a 32bit int to a 64bit void*, but is
> there any way I can lose the warning without breaking the code? :)
The API do seem wrong here, casting an int to a pointer isn't
generally safe. It should probably be changed to take a socket
pointer instead, e.g.:
gnutls_transport_set_ptr(session->sess, (gnutls_transport_ptr_t) &fd);
But this break all existing uses. We could invent a new API and
deprecate this one. Opinions? Suggestions for the API name?
If there is some easier solution, i.e, if POSIX or something says that
void* must be able to hold all int values, and there is some
workaround to avoid the warning, maybe we can recommend that instead.
Updating all callers to this function is rather tedious work,
especially if all it solves is to get rid of a warning.
More information about the Gnutls-help