From: Mark Williamson Subject: Re: __RING_SIZE() macro not aconstant when compiling under windows Date: Sat, 27 Oct 2007 14:20:47 +0100 Message-ID: <200710271420.47630.mark.williamson@cl.cam.ac.uk> References: Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit 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: xen-devel@lists.xensource.com Cc: James Harper List-Id: xen-devel@lists.xenproject.org > 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!