Pype.Clicker wrote:
I haven't read from LKML that they think writing "a kernel in C++" is not a GoodIdea (tm), just that "Rewriting the Linux Kernel" is not a GoodIdea (tm)...
Believe me, I've read the whole flame-mega-thread on the subject (back when I was evaluating whether to write
my kernel in C++, looking for contra arguments)... the FAQ header might not look like it, but there's a general anti-C++ movement in the Linux kernel camp. Not just in regard to Linux. They consider C++ to be unfit for kernel work, and C++ coders to be third grade citizens at best...
Quote:
...and concerning this, i *do* agree with them. Porting a millions line multi-platform (thus multi-compilers) project towards a language that's beginning to have a commonly accepted ABI ... argh.
The point is that
nobody ever asked for a "rewrite"! The whole thing started with someone asking if it would be possible to support people who wanted to write kernel
modules (i.e., drivers) in C++. As it is, the kernel headers make liberate use of C++ keywords for identifiers, making it virtually impossible to use C++ for
any kind of kernel work.
The answer was, "we think you cannot write kernel space C++, do it in C or all you prove is your incompetence. We don't want C++ kernel modules even if you gave us money for it, and all the C++ keywords will remain in there."
I
especially like this part in the LKML FAQ:
Quote:
So Erik Mouw did a short back-of-the-envelope calculation to show that searching the kernel sources for possible C++ keywords is a nightmare. Here is his calculation and comments (dates April, 2002):
% find /usr/src/linux-2.4.19-pre3-rmap12h -name "*.[chS]" | xargs cat | wc -l
4078662
So there's over 4 million lines of kernel source. Let's assume 10% is comments, so there's about 3.6 million lines left. Each of those lines has to be checked for C++ keywords. Assume that you can do about 5 seconds per line (very optimistic), work 24 hours per day, and 7 days a week:
Code:
5 s 1 hour 1 day 1 week
3600000 lines * ------ * -------- * ---------- * -------- = 29.8 weeks
line 3600 s 24 hours 7 days
That's hilarious. There are less than 20 keywords that C++ added to C. If you can do find / cat / wc magic like that shown above, how hard can it be to do a grep on a measly 20 keywords? Or a simple sed to change them to non-keywords in one go?
Xenophobia, that's the word for it...