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] __RING_SIZE() macro not aconstant when compiling under w

To: xen-devel@xxxxxxxxxxxxxxxxxxx
Subject: Re: [Xen-devel] __RING_SIZE() macro not aconstant when compiling under windows
From: Mark Williamson <mark.williamson@xxxxxxxxxxxx>
Date: Sat, 27 Oct 2007 14:20:47 +0100
Cc: James Harper <james.harper@xxxxxxxxxxxxxxxx>
Delivery-date: Sat, 27 Oct 2007 06:21:31 -0700
Envelope-to: www-data@xxxxxxxxxxxxxxxxxx
In-reply-to: <AEC6C66638C05B468B556EA548C1A77D01249CD0@trantor>
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/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=subscribe>
List-unsubscribe: <http://lists.xensource.com/cgi-bin/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xensource.com?subject=unsubscribe>
References: <AEC6C66638C05B468B556EA548C1A77D01249CD0@trantor>
Sender: xen-devel-bounces@xxxxxxxxxxxxxxxxxxx
User-agent: KMail/1.9.6 (enterprise 0.20070907.709405)
> When I try and use the __RING_SIZE() macro under windows as the size of
> an array, the ddk compiler complains that it's not a constant
> expression. The exact error it gives is
>
> "
> c:\projects\xen\xenvbd\xenvbd.h(43) : error C2057: expected constant
> expression
> "
>
> Is there something special about gcc that would let this work under it
> but not under the windows compiler?

__RING_SIZE() isn't necessarily plain constant - it does calculations.  In 
practice, these can typically be evaluated at compile time (if sz is a 
constant).  I don't know the C spec well enough to know if it's appropriate 
to reject this...

But __RING_SIZE isn't (as far as I know) actually used anywhere to size 
arrays?  It's used internally by the other macros in ring.h to set up various 
book keeping.  So I'm not sure that you should necessarily need to use the 
macro this way...?

Cheers,
Mark

-- 
Dave: Just a question. What use is a unicyle with no seat?  And no pedals!
Mark: To answer a question with a question: What use is a skateboard?
Dave: Skateboards have wheels.
Mark: My wheel has a wheel!

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