Object-oriented design patterns in the kernel, part 1
Posted Jun 1, 2011 21:31 UTC (Wed) by pr1268
In reply to: Object-oriented design patterns in the kernel, part 1
Parent article: Object-oriented design patterns in the kernel, part 1
Now I can't resist. Linus' bias against C++ notwithstanding, there are some seriously good reasons to avoid using it for kernel programming:
- Using C++'s standard library types and features generates a lot of object code bloat. Trust me, I refactored some of my own programs from C++ back to C and got ELF objects less than half as big.
- Generally speaking, use of higher-level language tools (such as the C++ standard library) tends to move the programmer further away from the bare metal (and kernel programming should be as close to the metal as possible).
- The use of a single programming language tends to make all participants have a similar mindset of the technical problems being solved, and
- Use of a low-level language where it's easy to "shoot your foot off" tends to weed out those without a thorough technical knowledge of kernel programming (Okay, I'm going into generalizations, here, but I'm sure I've read Linus mention something similar to these a while back).
Bear in mind that I'm a devout C++ programmer—I really do love to code in both C and C++. It's just that I think Linus' arguments against C++ with respect to kernel programming are justified.
Please do NOT read this as an attempt to start a language war—again I love both languages!
to post comments)