[PATCH] Fix cast int-to-pointer and pointer-to-int

Tomas Carnecky tom at dbservice.com
Thu Feb 5 10:22:10 PST 2009


On 02/05/2009 07:16 PM, Paulo César Pereira de Andrade wrote:
> Simon Thum wrote:
>> Tomas Carnecky wrote:
>>> By first casting to long and then to the final type. Of course
>>> this assumes that sizeof(long) == sizeof(void *). If the Win32
>
>    Forgive my stupidity, but isn't it a C language rule that
> sizeof(long) == sizeof(void *) is always true?

The C standard doesn't say that. On Unix that is true, on Windows and 
Mac not so much. Here is a nice summary showing the different 
architectures and their integer sizes: 
http://www.unix.org/version2/whatsnew/lp64_wp.html - see the table in 
the "TECHNICAL CHOICES" section.

tom




More information about the xorg mailing list