C++ in the kernel

Pieter Dumon pieter.dumon at gmail.com
Wed Jan 7 12:54:43 PST 2009


Actually, The language of choice is not the important question. It's
the conceptual/implementation innovation in DragonFly which matters.
As we move to highly multicore or high CPU count computer systems even
for consumer applications, the things DragonFly started tackling some
years ago no become even more and more relevant.


On Mon, Jan 5, 2009 at 11:49 AM, Erik Wikström <Erik-wikstrom at telia.com> wrote:
> It would be interesting to see how much work it would take to compile
> the kernel with g++ instead, after all most valid C is also valid (and
> semantically equal) C++.

Most valid C is valid C++, yes. But there's a difference between valid
and how it's meant.
E.g. consts and other things in C++ are explicitely meant to get rid
of the precompiler mess. (Yes, you may love or hate the precompiler of
course).
If you're seriously doing C++, you would really do some things
different, even though indeed most C code compiles with a C++
compiler.
In most kernels, hardware dependencies are abstracted out with a lot
of help of the precompiler. This shows its great power, but also in
some cases (not specifically talking about DragonFly here :-)) to
unreadable and therefore crappy code. Maybe you can do it different, I
don't know.

But hey, better to keep it 'pure' C if it is C now :-)


cheers,
Pieter





More information about the Kernel mailing list