> From: Stephen Hemminger [mailto:[email protected]] > Sent: Saturday, 11 November 2023 18.22 > > The method of doing sizeof a bad array element was an interesting > hack but it has a couple of problems. First, it won't work if > VLA checking is enabled. It doesn't enforce that the expression > is constant. > > Replace that with the _Static_assert builtin available in > Gcc, Clang, and MSVC. > > Signed-off-by: Stephen Hemminger <[email protected]> > ---
Two souls, one thought... I have been considering exactly the same, and thus strongly support this. > -#define RTE_BUILD_BUG_ON(condition) ((void)sizeof(char[1 - > 2*!!(condition)])) > +#define RTE_BUILD_BUG_ON(e) _Static_assert(!(e), #e) Please use static_assert instead of _Static_assert, as discussed with Bruce: http://inbox.dpdk.org/dev/zr%[email protected]/ Acked-by: Morten Brørup <[email protected]>

