this post was submitted on 09 Nov 2025
73 points (96.2% liked)

Linux

10196 readers
848 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
 

Two patches queued into the Linux kernel's build system development tree, kbuild-next, would enable the -fms-extensions compiler argument everywhere for allowing GCC and LLVM/Clang to use the Microsoft C Extensions when compiling the Linux kernel. Being in kbuild-next these patches will likely be submitted for the Linux 6.19 kernel merge window next month but remains to be seen if there will be any last minute objections to this change.

The -fms-extensions compiler option honored by the GNU Compiler Collection and LLVM/Clang allow enabling some non-standard C/C++ constructs used within Microsoft header files and honored by the the Microsoft Visual C/C++ compiler. For Linux kernel development purposes, enabling the Microsoft C Extensions would allow including a tagged struct or union anonymously in another struct/union.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] DeltaWingDragon@sh.itjust.works 1 points 1 week ago (1 children)

Does that really have the same results as the example scenario I described? How would you even access the unnamed struct, since it is unnamed?

[โ€“] entwine@programming.dev 1 points 1 week ago* (last edited 1 week ago)

The same way you did, via the name of the member: my_test.test2.b = 'x';

The unnamed struct provides the type for a member named test2. Doing it this way saves you the trouble of defining the struct externally and giving it a name. It's identical to this, except in this example you can reuse the struct definition:

struct crappyname {
    char b;
    float c;
};
struct test {
    int a;
    struct crappyname test2;
    double d;
};