The Linux Kernel Looks To 'Bite the Bullet' In Enabling Microsoft C Extensions (phoronix.com) 15
Linux kernel developers are moving toward enabling Microsoft C Extensions (-fms-extensions) by default in Linux 6.19, with Linus Torvalds signaling no objection. While some dislike relying on Microsoft-style behavior, the patches in kbuild-next suggest the project is ready to "bite the bullet" and adopt the extensions system-wide. Phoronix reports: Rasmus Villemoes argued with Kbuild: enable -fms-extensions that would allow for "prettier code" and others have noted in the past the potential for saving stack space and all around being beneficial in being able to leverage the Microsoft C behavior: "Once in a while, it turns out that enabling -fms-extensions could allow some slightly prettier code. But every time it has come up, the code that had to be used instead has been deemed 'not too awful' and not worth introducing another compiler flag for. That's probably true for each individual case, but then it's somewhat of a chicken/egg situation. If we just 'bite the bullet' as Linus says and enable it once and for all, it is available whenever a use case turns up, and no individual case has to justify it..."
The second patch is kbuild: Add '-fms-extensions' to areas with dedicated CFLAGS to ensure -fms-extensions is passed for the CPU architectures that rely on their own CFLAGS being set rather than the main KBUILD_CFLAGS. Linus Torvalds chimed in on the prior mailing list discussion and doesn't appear to be against enabling -fms-extensions beginning with the Linux 6.19 kernel.
The second patch is kbuild: Add '-fms-extensions' to areas with dedicated CFLAGS to ensure -fms-extensions is passed for the CPU architectures that rely on their own CFLAGS being set rather than the main KBUILD_CFLAGS. Linus Torvalds chimed in on the prior mailing list discussion and doesn't appear to be against enabling -fms-extensions beginning with the Linux 6.19 kernel.
Well, I suppose -fms-extensions is better than (Score:4, Funny)
-embrace-extend-extinguish
Re: (Score:3)
It's a GNU-flavored version of those MS extensions, originally they added a subset of what MS does in order to let gcc use data structures in MS's headers and have somewhat source compatible builds (I think this was roughly around the time Cygwin popped up, but I'm not sure).
A fair number of professional teams enabled those extensions for non-Windows code because they like some of the tricks available with the extensions and use it in their proprietary or open source code. It's a trend that has finally spre
Re: (Score:2)
Or maybe he has more clue about those "microsoft extensions" actually do.
Old Terminology (Score:1)
Kernel (Score:2)
Re: (Score:2)
"If you're root, you are assumed to know what you're doing"
Clearly you've never used MacOS where even root is a 2nd class user in some instances. All for security reasons don't you know - System Integrity Protection or whatever they've called it this month.
Bad name, they're not actually microsoft (Score:3)
The actual feature enabled by the "-fms-extensions" option in gcc is anonymous member structs and unions, which had first appeared in plan9 and was invented by the same people who created the C language in the first place.
Re: (Score:3)
That extension basically lets you to extend C structs like in C++, but allows you to add new members *both* at the start and at the end of the base struct:
struct foo {
int m;
};
struct bar {
int before;
struct foo;
int after;
};
int main() {
struct bar b; b.m = 33;
}
Re: (Score:2)
IMO this is a good thing, not a bad one.
Re: (Score:2)
Example:
struct object {
enum object_type type;
union {
struct { struct object *car; struct object *cdr; };
double number;
};
};
struct object *foo;
Now we can say foo->cdr instead of (say) foo->value.cons.cdr.