News for hackers. Stuff that matters.
Re:Switching to C over 'Modern' Programming Languages by tialaramex on Thursday April 13, 2023 @09:03AM (#35554777)
Linux isn't written in standard C. Not only does it not accept C's aliasing rules (hence the kernel is compiled with them disabled, which the standard doesn't offer), it doesn't even accept the memory model, because it had its own memory model first and it likes that one better.

As a result to some extent GCC and Clang are also compilers for some sort of "Linux C" which is strongly reminiscent of the ISO standard language but distinct.

And there's no reason you would choose C++ for a project where you'd otherwise use C on account of the (exaggerated) relationship between the two languages, the reason you'd do it would be that you want C++ features, and Linus doesn't want C++ features. Projects to "just" compile the existing Linux code but with C++ compilers failed AFAIK.

Re:Switching to C over 'Modern' Programming Languages by shrimp_emoji on Thursday April 13, 2023 @09:57AM (#35555537)
Re:Switching to C over 'Modern' Programming Languages by flohofwoe on Friday April 14, 2023 @03:36AM (#35566601)
Unions for type punning is actually entirely valid in C, it's only UB in C++.

(I agree though that the C standard isn't actually relevant in the real world, most C compilers treat it more or less as a 'suggestion', unless enforced with options like '-pedantic')