[tor-dev] building from source in a 64-bit windows environment..

Anthony Martin ality at pbrane.org
Sat May 18 19:03:25 UTC 2013


Zack Weinberg <zackw at panix.com> once said:
> First, 'size_t' is required to be able to represent the size
> of any object;

Agreed.

> Second, 'size_t' is required to be no larger than 'unsigned long'.

Agreed.

> when the memory space is flat, this entails that 'void*' can
> be cast to 'size_t' and back without loss of information

This is the part I disagree with. It's a non-portable assumption
and the standard makes no such guarantee. The relevant sections
concerning casts from integral types to pointer types are full of
implementation-defined caveats. Imagine a system where you only
have access to a flat 32-bit address space and size_t is 32 bits
but where pointers are 33 bits with the top bit always set.
Useless as it may be, this would still conform to C89.

Integer to pointer conversions should be handled with care.
Systems where long has the same size as a pointer lead to
carelessness in my opinion. ☺

Cheers,
  Anthony


More information about the tor-dev mailing list