[PATCH] Cast small-int values through intptr_t when they're passed as pointers.

Daniel Stone daniel at fooishbar.org
Mon Oct 5 15:28:31 PDT 2009


On Mon, Oct 05, 2009 at 11:04:18AM -0700, Alan Coopersmith wrote:
> Daniel Stone wrote:
> > On Fri, Oct 02, 2009 at 01:42:50PM -0700, Jamey Sharp wrote:
> >> On 64-bit systems, int and pointers don't have the same size, so GCC gives
> >> warnings about casts between int and pointer types. However, in the cases
> >> covered by this patch, it's always a value that fits in int being stored
> >> temporarily as a pointer and then converted back later, which is safe.
> >> Casting through the pointer-sized integer type intptr_t convinces the
> >> compiler that this is OK.
> >>
> >> Signed-off-by: Jamey Sharp <jamey at minilop.net>
> > 
> > Alan, Matthieu -- is this portable enough?
> 
> intptr_t has been in Solaris since 64-bit support was added in Solaris 7.

Okay, looks like we can use it no problems then.

Acked-by: Daniel Stone <daniel at fooishbar.org>

Merged into ~daniels/xserver.

Cheers,
Daniel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
Url : http://lists.x.org/archives/xorg-devel/attachments/20091006/6c82ab28/attachment.pgp 


More information about the xorg-devel mailing list