Messages in this thread | | | From | "Alexander Vlasenko" <> | Subject | Re: C++ in kernel | Date | Mon, 11 Jan 1999 22:09:46 +0200 |
| |
In my opinion C++ can be used as cleaner and safer C. C++ has lots of really useful features.
Features that help catch errors early: * const pointers * private struct members * stricter type checking
Features that improve code safety: * constant variables (safer than #defines) * inline funcs (safer than #defines)
I can present code examples for each of these features which show C++ superiority over C. Anyone doubts that?
However thre are things which can screw up kernel. These things should be prohibited in kernel code: * multiple and virtual inheritance * massive function and operator overloading * massive conversion ops * exceptions * templates
BTW, you can write bad code in C too. :-)
In my experience converting good C code to C++ is easy. First one should make headers C++-compatible, then compile some modules in C++ and fix all errors/warnings (even good C code generates C++ warnings and even errors! C++ enforce clean coding practice). However kernel code is big and changing all the time. I see no practical means to go C++ now. It's not very important, some developers don't want C++ (it seems they are not familiar with it). -- Denis Vlasenko
- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/
| |