News for hackers. Stuff that matters.
Re:9front "This Was Supposed to Be Fun" Released by wahern on Monday August 03, 2026 @06:25PM (#49162270)
C99 added designated initializers and compound literals, and C11 added anonymous structs and unions of the kind you showed above. These are 3 of the biggest features Plan 9 added to C, and they were adopted relatively quickly. But there's another type of anonymous struct/union Plan 9 added; using a bare tag name, e.g. `struct foo { union bar; };` to implicitly define the members. And Plan 9 C will also automagically coerce (and adjust the pointer offset) a struct reference to a reference to a typed anonymous member when calling a function that takes the latter. And now that I think about it, this seems like the obvious predecessor to Go's duck typing.
Re:9front "This Was Supposed to Be Fun" Released by asveikau on Saturday August 08, 2026 @02:00PM (#49224201)
GCC and VC++ supported anonymous structs and unions long before C11.