|
|
|
|
|
by grav1tas
5553 days ago
|
|
I think to call C++ compilers a black box and then turn around and say something like gcc is not is a bit of a stretch, and simply unfair to C++. The largess of the GNU C compiler is the very definition of a black box. If you're going to run off and do loads of systems programming, you're going to have to understand exactly how your black box works. This is still very possible with C++, it's just a lot more complicated given the semantics of the language. I think this back and forth sort of breaks down because people say things like C and C++ and it's not clear if they're talking about 1) The languages themselves.
2) The compilers
3) Possible runtimes and other overhead that need to be considered in a stereotypical environment (that is, probably not kernel coding). It tweeks me every time we get into a language war, because a lot of the time the language itself isn't the real point of discussion, but rather it's some sideways way of referring to the toolchain that's popular at the given moment. C++ as a language could very well be tooled to write a kernel, given a good compiler and a semantics that coders stick to (just like C). I feel like the C++/HLL camps are crying for something other than C because they're not interested in the super low level details, but still would like to eek some functionality out of the kernel. They're basically saying, "we would prefer tools other than C" (regardless of whether C++ is a worthwhile and better option, I am unconvinced). I think an even more interesting conversation to have would be: have operating systems kernels become TOO COMPLEX to code in (just) C/ASM? Are we in over our heads? Should we invest in the creation of better tools to handle such large, complex systems or is everything just fine? DISCLAIMER: I actually don't like programming in C++. I will put up with C, but I usually find myself writing in Ruby or Haskell. |
|
I fundamentally disagree with the notion that you can write /good/ kernel code in a HLL. A kernel is ALL ABOUT interacting with the hardware and performing low level system management. Sure, you could write kernel code in a HLL, but it is just not going to be as performant as if you wrote the code with "the super low level details" in mind. These are important considerations that compilers do not have insight into. I would go on to argue that to anyone who understood the low level details required to write quality kernel code, those details are not something they wish to overlook. Anyone who doesn't understand those details shouldn't be writing kernel code.