[PATCH] Fix cast int-to-pointer and pointer-to-int
Paulo César Pereira de Andrade
pcpa at mandriva.com.br
Thu Feb 5 10:16:47 PST 2009
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?
This of course may have special handling inside the kernel
as one may be using a 32 bit cpu with more then 4GB of RAM,
or just file offsets...
In Xorg, afaik this is only an issue for physical addresses,
but I don't know if there may be problems when mapping a
"physical address" above 4GB to a 32 bits virtual address.
> On this page:
It appears to be only showing that when sizeof(int) != sizeof(long)
you may have trouble addressing arrays larger then 4GB :-)
> they explain that indeed there are memory models where this doesn't hold.
> +1 for uintptr_t
>> folks care enough about warnings, we could make macros for this.
More information about the xorg