4 ms·
It sounds like they took someone's patch, which renamed some identifiers to not conflict with the handful of new keywords added in C++, and ignored it. Then th
by jongraehl 17y ago
It sounds like they took someone's patch, which renamed some identifiers to not conflict with the handful of new keywords added in C++, and ignored it.
Then they bragged about it.
That seems to be more political than technical.
- Locke1689 17y agoI'd say the exact opposite. What is the point of replacing the conflicts with C++? Torvalds makes a very good case for not using C++ in the Linux kernel. At the very least, it seems like hiding memory allocation in kernel level code is a recipe for disaster. Of course, one could argue that you can use malloc in C++ just as well as in C, but then are you really writing C++? It seems as though you're writing C code in C++. In fact, many of the language "features" that C++ offers seem to be Very Bad Ideas(TM) in the kernel. In addition, as Linus responded earlier, anyone who has written a modicum of C code knows that you don't need the complex language features of C++ to write modular, object oriented code (in fact, I'd argue that C++ is a blight upon OO and should probably die a horrible death, but that's neither here nor there). Most notably, however, is simply that it is not the Linux team's responsibility to defend their use of C over C++ -- given the amount of code that must be adapted, it is more appropriate for the C++ devs to argue what heavy benefits C++ has in its favor (such that they merit the transformation of a complex and significantly large body of code). I would actually say the C++ dev's view is more political than technical: advocating the switch to C++ "just because," implies a political (or religious) reasoning, while the Linux team's view seems much more technical.
- wglb 17y agoAs someone who has done some seriously low-latency projects on C++, there are really many levels that you can do this at. You can turn off exceptions, do constructors very sparingly, handle your own memory management and so on. As was said by its creator, C++ is a multi-paradigm programming language. There is something to be said for doing a lot of kernel stuff in template metaprogramming.
- swolchok 17y ago(Could've sworn this was in C++ FAQ Lite, but I can't find it) The language specifies exceptions as a feature, not an option. Turning off a language feature and how that works with other features that may reference it is a heavily compiler-specific endeavor, and isn't C++.
- wglb 17y agoYes, you are correct. In my high-performance version, I used an extension of the language provided by g++ which allowed turning off of exceptions, which sadly cost time even if you don't use them.