From: "Jan Beulich" Subject: Re: __RING_SIZE() macro not aconstant when compiling under windows Date: Mon, 29 Oct 2007 08:53:23 +0000 Message-ID: <4725AD93.76E4.0078.0@novell.com> References: Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Return-path: In-Reply-To: Content-Disposition: inline List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xensource.com Errors-To: xen-devel-bounces@lists.xensource.com To: James Harper Cc: xen-devel@lists.xensource.com List-Id: xen-devel@lists.xenproject.org >>> "James Harper" 27.10.07 13:36 >>> >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? I would think that this is a compiler bug, especially since (trivial = workaround for you) adding the address-of operator as in #define __RING_SIZE(_s, _sz) \ (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0]= ))) makes the code compile (the operator shouldn't be needed since the conversion is being done implicitly anyway - otherwise the cast wouldn't work). Since this should be a benign change for all other compilers, it = may be reasonable to change the public header this way. Jan