Re: C++ pushback

From: Jan-Benedict Glaw
Date: Wed Apr 26 2006 - 16:25:22 EST


On Wed, 2006-04-26 13:09:38 -0700, Linus Torvalds <torvalds@xxxxxxxx> wrote:
> On Wed, 26 Apr 2006, Jan-Benedict Glaw wrote:
> > There's one _practical_ thing you need to keep in mind: you'll either
> > need 'C++'-clean kernel headers (to interface low-level kernel
> > functions) or a separate set of headers.
>
> I suspect it would be easier to just do
>
> extern "C" {
> #include <linux/xyz.h>
> ...
> }
>
> instead of having anything really C++'aware in the headers.

...but you need to admit that your left hand tried to make your right
hand not typing this, didn't it?

> - the language just sucks. Sorry, but it does.
> - some of the C features we use may or may not be usable from C++
> (statement expressions?)

In the constructor pathes, I expect higher stack usage than we now
have.

> - a lot of the C++ features just won't be supported sanely (ie the kernel
> infrastructure just doesn't do exceptions for C++, nor will it run any
> static constructors etc).

So what actually can be made useable (and what actually makes sense):

* Classes with public and private funct^Wmembers, constructors.
* Namespaces? Don't think they're all _that_ useful for us.
* Static constructors probably won't fly.

> Anyway, it should all be doable. Not necessarily even very hard. But I
> doubt it's worth it.

I guess if somebody has a large portion of well-separated C++ code
(eg. a complete and complex filesystem), it would be easier to write
some glue code to "run" the C++ code with the kernel.

Though it would be even easier to use FUSE's bindings:-)

MfG, JBG

--
Jan-Benedict Glaw jbglaw@xxxxxxxxxx . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fÃr einen Freien Staat voll Freier BÃrger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));

Attachment: signature.asc
Description: Digital signature