Patch for MinGW-W64 port

B. Scott Michel scottm at
Fri Mar 23 01:34:43 CET 2012


On 22.03.2012 12:26, Eli Zaretskii wrote: 

>> Date: Thu, 22 Mar
2012 19:43:24 +0100 From: Nikos Mavrogiannopoulos <nmav at [1]>
Cc: gnutls-devel at [2] 
>>> - gnutls_transport_set_ptr
(session, (gnutls_transport_ptr_t) sd); + gnutls_transport_set_ptr
(session, (gnutls_transport_ptr_t) ((ptrdiff_t) sd));
>> What difference
do you see with ptrdiff_t comparing to unsigned long?
> 64-bit
Windows uses the LLP64 model, so `unsigned long' is a 32-bit
> type. By
contrast, ptrdiff_t is a (signed) 64-bit type.
>>> +
$ac_cv_sizeof_long_long) + AC_DEFINE([GNUTLS_POINTER_TO_INT_CAST],
[(long long)], + [Additional cast to bring void* to a type castable to
int.]) + ;;
>> Why use long long for pointer to int? Isn't in this
platform sizeof(void*)==sizeof(long)?
> No, see above. On 64-bit
Windows, sizeof(void *) == sizeof(long long)

Yes, what Eli said... By
definition, ptrdiff_t is the difference between two pointers, which is
preferred if one is going to do pointer arithmetic, irrespective of
platform word size. Hence, one benefit of the patch is increased
portability, if not standards conformance.


mailto:nmav at
[2] mailto:gnutls-devel at
-------------- next part --------------
An HTML attachment was scrubbed...
URL: </pipermail/attachments/20120322/3d0b0957/attachment.htm>

More information about the Gnutls-devel mailing list