WARNING - OLD ARCHIVES

This is an archived copy of the Xen.org mailing list, which we have preserved to ensure that existing links to archives are not broken. The live archive, which contains the latest emails, can be found at http://lists.xen.org/
   
 
 
Xen 
 
Home Products Support Community News
 
   
 

xen-devel

Re: [Xen-devel] [PATCH 08 of 15] hvmloader: Add a simple "scratch alloca

To: Konrad Rzeszutek Wilk <konrad.wilk@xxxxxxxxxx>, Ian Campbell <ian.campbell@xxxxxxxxxx>
Subject: Re: [Xen-devel] [PATCH 08 of 15] hvmloader: Add a simple "scratch allocator"
From: Keir Fraser <keir.xen@xxxxxxxxx>
Date: Thu, 02 Jun 2011 21:00:47 +0100
Cc: xen-devel@xxxxxxxxxxxxxxxxxxx
Delivery-date: Thu, 02 Jun 2011 13:03:51 -0700
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:user-agent:date:subject:from:to:cc:message-id :thread-topic:thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; bh=D2bOhn/840C5h0TGiJH6Hdj2bNSvFepeffnhzcNPv4I=; b=mtCHEMr1L45QvZ3ykeMDccGL7DdyiakRSQIR7IjeJvQzk4u9KOjKPKSDogVYqlG2Gc zrHKNWBYj3WzN52SpbcMaLuvrzmv84XmAgYHoaakGjjO6GlbyMSyDN+oLA64bBAxfpLh D+TPMsLFDndwiBqNdSeJsxweqZOgS/4Xks7PU=
Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=user-agent:date:subject:from:to:cc:message-id:thread-topic :thread-index:in-reply-to:mime-version:content-type :content-transfer-encoding; b=RZ5wZywJxsnxRQAJd92taTNAOJJH2kgbmMK+7Ruj9fYbrOnA/0fI2kuvmdT1zu3qq1 y79bqJDrFUsy5GVre/7umqhQM3iRaKUeCHH3MYQNAYigBfT8j2kWqP3zuT26bbck+m34 og6vvGyDEGflALro1MKer61vpRZ+8CGY03i6Y=
Envelope-to: www-data@xxxxxxxxxxxxxxxxxxx
In-reply-to: <20110602194331.GA32344@xxxxxxxxxxxx>
List-help: <mailto:xen-devel-request@lists.xensource.com?subject=help>
List-id: Xen developer discussion <xen-devel.lists.xensource.com>
List-post: <mailto:xen-devel@lists.xensource.com>
List-subscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
Thread-index: AcwhX8NaqqKWzUFMr06r2NZT/R6/Yg==
Thread-topic: [Xen-devel] [PATCH 08 of 15] hvmloader: Add a simple "scratch allocator"
User-agent: Microsoft-Entourage/12.29.0.110113
On 02/06/2011 20:43, "Konrad Rzeszutek Wilk" <konrad.wilk@xxxxxxxxxx> 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



_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-devel