[PATCH] Fix cast int-to-pointer and pointer-to-int
Tomas Carnecky
tom at dbservice.com
Thu Feb 5 09:25:40 PST 2009
On 02/04/2009 09:04 PM, Joerg Sonnenberger wrote:
> On Wed, Feb 04, 2009 at 08:43:43PM +0100, 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
>> folks care enough about warnings, we could make macros for this.
>
> Please use either uintptr_t (prefered) or size_t (fallback) instead of
> long. Also really make this a macro so that it can easily be searched
> for.
uintptr_t doesn't guarantee what we need either. It only guarantees
void* -> intptr_t -> void* conversion, but we also need 'intptr_t ->
void* -> intptr_t'. The man page (stdint.h) doesn't say that intptr_t
has to be the same width as pointers. It could be 128bits and gcc would
still throw a warning.
But if that's considered a non-issue, I'll change the code.
tom
More information about the xorg
mailing list