[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [tor-dev] building from source in a 64-bit windows environment..
Zack Weinberg <zackw@xxxxxxxxx> 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
_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev