[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] __RING_SIZE() macro not aconstant when compiling under windows



>>> "James Harper" <james.harper@xxxxxxxxxxxxxxxx> 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


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


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.