Re: C++ in kernel (was Re: exception in a device driver)

Peter T. Breuer (ptb@it.uc3m.es)
Thu, 7 Jan 1999 17:24:47 +0100 (MET)


"A month of sundays ago Alan Cox wrote:"
>
> > Until then, its time to start considering getting the kernel's code
> > buildable by g++ a little at a time. Just using it as a "better C" rather than
> > bringing all its features in at once would make for a cleaner system and extend
>
> Been there, done that, didnt like it threw it out. There were several problems
> that came up. Firstly the resulting code was less efficient - that is partly
> the compiler but does seem to be at least fractionally the language - its very
> hard to figure out in C++ when you can avoid passing 'self' around for
> example.

Indeed - the problem with C++ is that it's model of inheritance is
static inheritance. This makes it fit poorly with the model of
inheritance that the kernel is explicitly providing (processes are
created dynamically and inherit from their parents as they are created!)
and so you can't use using C++ to do the work for you in this regard.
You have to pass self around. Now, smalltalk ...

Ah well. C++ would provide better typechecking. The problem is that it is
incompatible in minor respects (varadicity, for example) with C, no
matter the claims made. That could be a major headache.

I think most of the typechecking gains can be got with gcc 2.8.1, or
egcs, or whatever.

Peter

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/