• mina86@lemmy.wtf
    link
    fedilink
    arrow-up
    8
    ·
    16 hours ago

    Minor correction: Unnamed structs and unions (so your second example) are not part of C. They are GNU extensions.

    • MinekPo1 [it/she]@lemmygrad.ml
      link
      fedilink
      arrow-up
      3
      ·
      edit-2
      12 hours ago

      “ANSI C” by Kernighan and Ritchie disagrees , including that syntax (note : retranslation from Polish as that’s the language my copy is in) :

      A8.3

      […]

      struct-union-specifier:
      , union-struct identifier ₒₚₜ { compound-declaration-list }
      , union-struct identifier

      […]

      Specifiers of structures or unions with [a compound declaration] list, but with no label [identifier], creates a unique type; it may only be referred to in the declaration in which it is part.