On Wednesday 09 November 2005 11:32 am, Steven T. Hatton wrote:
The places where C++ code can be faster are not relevant to a lot of applications. They mostly apply to number crunching and chains of mathematical expressions. If I get motivated, I may try to fish out an example.
As for why the kernel is written in C++. 1) Linus doesn't know how to use C++ correctly 2) C++ was not mature when the linux project was started 3) There's a certain amount of chicken and egg problem in that C++ relies on functionality provided by the kernel. Of course all that is done in C within the kernel could be done with C++. The differences between ANSI C and the C subset of C++ are trivial. This is another discussion, maybe we should take it to programming. We discussed rewriting parts of a commercial Unix kernel in C++. I don't want to degenerate into a C/C++ discussion, but in general a C compiler is able to optimize better than a C++ compiler. Another issue with C++ when dealing with a kernel is its libraries. When you compile a kernel, you are completely stand-alone. -- Jerry Feldman <gaf@blu.org> Boston Linux and Unix user group http://www.blu.org PGP key id:C5061EA9 PGP Key fingerprint:053C 73EC 3AC1 5C44 3E14 9245 FB00 3ED5 C506 1EA9