4 ms·
Y'know, these kinds of problems could have been avoided if Linus had simply... allowed C++ in the kernel. This may not be an "RMS not allowing GCC to expose the
by bitwize 5y ago
Y'know, these kinds of problems could have been avoided if Linus had simply... allowed C++ in the kernel. This may not be an "RMS not allowing GCC to expose the AST" tier instance of the BDFL obstructing a project's forward progress, but it's clear real damage has been done.
- dbrueck 5y agoThe cost/benefit ratio would be way off though. The article mentions one of the proposals that Linus shot down "because it did nothing to prevent future problems from being introduced". Were they to use C++ in the kernel they'd have to first define which subset of C++ is allowed (in practice pretty much nobody uses all of C++ but instead uses some subset of it that they have more or less learned to use safely, and that subset varies wildly from person to person), and /then/ they'd have to add tooling to make sure nobody varies from that subset. :)
- pjmlp 5y agoArduino, Espressif, Google, Apple, Microsoft, IBM and ARM are perfectly confortable defining such C++ subset.
- stjohnswarts 5y agoHonestly the core kernel programmers are extremely intelligent and I would trust their "subset" selection better than 99.999% of the other coders out there. Tamed of course with some input from graybeards like Stroustrup who I'm sure would be happy to interject his guidance ;) . I kind of wish Linus would relent...
- adgjlsfhk1 5y agogreat! they have selected a subset. It's called C.
- deleted 5y ago[deleted]
- saagarjha 5y agoWell, C plus a bunch of horrific GNU macros and special compiler flags ;)
- throwawaylinux 5y agoWhat C++ features have you missed when working on the kernel?
- jcelerier 5y agoThis thread is literally about something that is a solved problem since 1991 in c++ (generic lists and data structures) and apparently still an issue in the kernel in 2022
- throwawaylinux 5y agoThis did not answer my question.
- jcelerier 5y agoIs "ability to write reusable generic containers" not an answer ?
- throwawaylinux 5y agoNo, because Linux has generic lists and data structures so you'd have to be more specific. Also I was asking a particular person to because their perspective would have been interesting to me, but if you're also a kernel developer I would be interested to hear your gripes too.
- cameryn7 5y agoIntrusive lists in C++ is not particularly more convenient over C (especially not in 1991's C++)
- pjmlp 5y agoBorland C++ 3.0 for MS-DOS supported templates in 1991. https://winworldpc.com/product/borland-c/30 https://winworldpc.com/product/borland-c/30
- tptacek 5y agoThere were strongly persuasive arguments against C++ when this was first litigated, and while those arguments have been blunted by C++'s progress in the ensuing time, at this point, if you're going to introduce a higher-level language to the kernel, it might as well be something with pro-forma memory safety, like Rust.
- imtringued 5y agoI'd say it would be worth it for drivers, especially if someone comes up with a stable API so that there can be a competing Rust kernel that reuses the drivers.
- pjmlp 5y agoI am waiting to see the reasoning why creative uses of Rust macros or generics aren't problem in the Linux kernel versus Ada/C++ (yes there was an Ada based distribution on the early 2000's). There are plenty of OSes using C++, at very least on kernel drivers.
- google234123 5y agoCan there really be fair arguments when you have a culture of bullying?
- tptacek 5y agoYes. Also, I didn't use the word "fair".
- jiggawatts 5y agoI wonder if instead of assuming that the only "upgrade" from C is straight to C++ with all of its attendant baggage, may be what's needed is C with traits/templates and strict macros. In other words, extend C in the same direction Rust took, but while retaining 100% backwards compatibility. Just adding traits and hygienic macros would make C much safer and ergonomic, while compiling down to normal C. Just a thought...
- pjmlp 5y agoBasically what Arduino, Espressif, Google, Apple, Microsoft, IBM and ARM are perfectly confortable defining their C++ subsets for drivers and bare metal development. But Linus being Linus that is "impossible".