73
this post was submitted on 09 Nov 2025
73 points (96.2% liked)
Linux
10196 readers
351 users here now
A community for everything relating to the GNU/Linux operating system (except the memes!)
Also, check out:
Original icon base courtesy of lewing@isc.tamu.edu and The GIMP
founded 2 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Why?
I'm sitting around doing IT shit waiting things to download/backup/install/etc and have nothing better to do, so here's an AI-free explanation with code samples:
It's basically just a code style thing. Standard C allows you to declare unnamed structs/unions within other structs/unions. They must be unnamed, so it'd look like this:
Which is fine, but the
-fms-extensionsflag enables you to do the same thing with named structs. For example:without
-fms-extensions, the above will compile, but won't do what you might assume.bandcwill be members of structtest2, nottest. So something like this won't compile:But with the flag, not only does it work, it also lets you do some convenient things like this:
That is, you can reuse an existing struct definition, which gives you a nice little tool to organize your code.
Source: https://gcc.gnu.org/onlinedocs/gcc/Unnamed-Fields.html
Nice, thank you