From mboxrd@z Thu Jan 1 00:00:00 1970 From: Keir Fraser Subject: Re: [PATCH 08 of 15] hvmloader: Add a simple "scratch allocator" Date: Thu, 02 Jun 2011 21:00:47 +0100 Message-ID: References: <20110602194331.GA32344@dumpdata.com> Mime-Version: 1.0 Content-Type: text/plain; charset="US-ASCII" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <20110602194331.GA32344@dumpdata.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: Konrad Rzeszutek Wilk , Ian Campbell Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org On 02/06/2011 20:43, "Konrad Rzeszutek Wilk" wrote: >> + return (void *)(unsigned long)s; > > Why the double cast? gcc complains if you cast between a pointer and an integer of a different size. We assume in many places that a pointer is same size as a long, so we cast through a long when the original integer type may be different size. In this case, in hvmloader, we know that pointers/longs/uint32_t are all 32-bit, but still I quite like the principle of always casting through a long when the integer is not explicitly that type already. -- Keir