From mboxrd@z Thu Jan 1 00:00:00 1970 From: Michael David Crawford Subject: Re: Casting 64-bit pointers to integers Date: Fri, 22 May 2009 02:53:38 -0700 Message-ID: <4A167622.2070105@prgmr.com> References: <4A1670BB.90101@prgmr.com> <20090522094141.GH10166@const.famille.thibault.fr> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20090522094141.GH10166@const.famille.thibault.fr> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Michael David Crawford , xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org Samuel Thibault wrote: > intptr_t/uintptr_t is there for this. In tools/xenpmd/acpi-events.c, which is in the git sources but doesn't seem to be in the 3.4 sources, there are two returns from acpi_events_thread which cast ints to void*'s. These break the compile on 64-bit. One of the ints is a socket_fd, the other is the result from a connect system call. I got it to compile at first by doing something like this: return (void*)(unsigned long long)socket_fd But what would be better is return (void*)(uintptr_t)socket_fd If you were to just make socket_fd a uintptr_t, it would lose precision when you passed it to connect. You could explicitly cast it to an int there, I suppose. Mike -- Michael David Crawford mdc@prgmr.com prgmr.com - We Don't Assume You Are Stupid. Xen-Powered Virtual Private Servers: http://prgmr.com/xen