|
From: Florian K. <fl...@ei...> - 2015-03-28 18:46:47
|
On 28.03.2015 10:19, Matthias Schwarzott wrote: > On 27.03.2015 23:18, Florian Krohm wrote: >> >> I like the implementation of VKI_STATIC_ASSERT (without the C++ >> mumbo-jumbo) better than what I came up with, as it avoids adding a >> symbol. So I would use that approach for VEX/VG_STATIC_ASSERT as well. I spoke too fast. VKI_STATIC_ASSERT cannot be used on file scope. So it's out. > > Maybe it is possible to use static_assert (C++-11) or _Static_assert > (should be in C11) if the compiler supports it. C++'s static_assert cannot be used on file scope either. So I ended up using +// Poor man's static assert +#define STATIC_ASSERT(x) extern int VG_(VG_(VG_(unused)))[(x) ? 1 : -1] which works in all scopes (expect function parameter scope).. Florian |