Anonymous union within struct not in c99?

Anonymous unions are a GNU extension, not part of any standard version of the C language. You can use -std=gnu99 or something like that for c99+GNU extensions, but it’s best to write proper C and not rely on extensions which provide nothing but syntactic sugar…

Edit: Anonymous unions were added in C11, so they are now a standard part of the language. Presumably GCC’s -std=c11 lets you use them.

Leave a Comment