DragonFly kernel List (threaded) for 2009-01
DragonFly BSD
DragonFly kernel List (threaded) for 2009-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: C++ in the kernel


From: Erik Wikström <Erik-wikstrom@xxxxxxxxx>
Date: Mon, 05 Jan 2009 11:49:26 +0100

On 2009-01-05 00:17, Michael Neumann wrote:
> Am 04.01.2009 19:26, schrieb Pieter Dumon:
>  > It's just political, there's pros and cons for everything.
>  > Its not because LT says something that it's true.
> 
> Oh, I love Linus for his "strong opinions". He makes me laugh :)

He's a known C++phobic and it's quite obvious that he's not very
familiar with the C++ language or how to use it.

>  > Some people have demonstrated nice work in C++ (e.g. some L4 variants).
>  > Whatever language you use, it all comes down to using it properly.
>  > But if your whole kernel is written in C, better to leave it at that :-)
>  > The worst thing you can do is mix and match C and C++ I think - that
>  > would be really crappy.
> 
> Yep, that is what I was thinking too. Mixing C and C++ is not nice. The
> two languages are still too different is some aspects. Nevertheless
> generics (i.e. C++ templates) and some form of subtyping could really
> help to make C a better, more expressive language.

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++. If one were to use C++ as what some call "C
with classes" and perhaps also templates there would not be much
difference, the big question is how much C++ features one would allow
i.e. virtual functions, multiple inheritance, etc.

Another possibility, depending on the modularity if the kernel, is to
compile one or more subsystems as C++ and then link them together. That
would allow for some parts to be written in C and others in C++.

-- 
Erik Wikström



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]