On Tue, Dec 01, 2026 at 11:37:56AM -0800, Stephen Hemminger wrote: > On Tue, 1 Dec 2026 18:22:44 +0000 > Bruce Richardson <[email protected]> wrote: > > > + */ > > +#define RTE_DEFINE_FLEX_BYTES(type, name, size) \ > > + static_assert((size) >= sizeof(type), "buffer smaller than " > > RTE_STR(type)); \ > > + union { \ > > + uint8_t raw[size]; /* first member, so "{0}" zeroes the whole > > buffer */ \ > > + type obj; \ > > + } name ## _u = {0}; \ > > + type * const name = &name ## _u.obj > > + > > Agree with Martin no VLA.
While these could be used with VLAs all use of this in this set is where size is a compile-time constant, so that we don't have VLAs on stack. I'll see if I can add a compile time assert to mandate fixed sizes here. Checking equivalent DEFINE_RAW_FLEX in kernel, I see it similarly mandates compile-time constant values for the size. /Bruce

