Re:Switching to C over 'Modern' Programming Languages
by shrimp_emoji on Thursday April 13, 2023 @09:57AM
(#35555537)
I'll just leave this here: https://lkml.org/lkml/2018/6/5/769 ;p
And maybe this: https://dl.acm.org/doi/10.1145/3477113.3487274
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')
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.