[Mesa-dev] Can we use anonymous unions?

Kenneth Graunke kenneth at whitecape.org
Tue Aug 18 09:56:49 PDT 2015


I was thinking about using an anonymous union.  Specifically, something

struct shader {
   union {
      struct geometry_shader_info gs;
      struct tess_eval_shader_info tes;

Are those acceptable in Mesa?  I don't think we've traditionally used
them, but I'm not sure why.  Apparently they're part of C11, though not
part of C99.  However, GCC allows them, presumably Clang, and it looks
like MSVC 2005 supports them in C:


We might be able to use these to avoid some of our fun
thing->base.Base.base.program.Base.base shenanigans...

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20150818/220415b8/attachment.sig>

More information about the mesa-dev mailing list