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

Peter Harris pharris at opentext.com
Thu Feb 5 10:25:23 PST 2009


Paulo César Pereira de Andrade wrote:
>   Forgive my stupidity, but isn't it a C language rule that
> sizeof(long) == sizeof(void *) is always true?

No, it is not a C language rule.

On older (16-bit) computers, setting a small memory model may result in
sizeof(long) == 4, and sizeof(void *) == 2.

Current 64-bit Windows compilers use sizeof(long) == 4 and sizeof(void
*) == 8.

Neither violate the C language spec.

Peter Harris
-- 
               Open Text Connectivity Solutions Group
Peter Harris                    http://www.opentext.com/connectivity
Research and Development        Phone: +1 905 762 6001
pharris at opentext.com            Toll Free: 1 877 359 4866



More information about the xorg mailing list