__DECLARE_FLEX_ARRAY(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– __DECLARE_FLEX_ARRAY(9) πŸ’–

okay so bestie, this is the Kernel API Manual page for __DECLARE_FLEX_ARRAY, and it's lowkey iconic for one very specific flexible-array-in-a-union situation. Let's get into it. 🫢


🌸 NAME 🌸

__DECLARE_FLEX_ARRAY β€” Declare a flexible array usable in a union. ✨

✨ SYNOPSIS ✨

__DECLARE_FLEX_ARRAY (TYPE , NAME );

πŸŽ€ ARGUMENTS πŸŽ€

  • TYPE β€” the type of each flexible array element. πŸ’…
  • NAME β€” the name of the flexible array member. πŸŽ€

πŸ¦‹ DESCRIPTION πŸ¦‹

okay so here's the tea: to have a flexible array member in a union, or alone in a struct, it needs to be wrapped in an anonymous struct with at least 1 named member. The plot twist? That named member can be empty. literally that's the whole vibe. 😭✨

πŸ‘‘ SEE ALSO πŸ‘‘

  • Kernel file ./tools/include/uapi/linux/stddef.h 🐧
  • __struct_group(9) 🫢

later bestie πŸ’– β€” this page is from ./tools/include/uapi/linux, dated October 2026, and it's the __DECLARE_FLEX_ARRAY(9) one. periodt. ✨

πŸ“¦ where this page comes from