C++ in the kernel

M. Warner Losh imp at bsdimp.com
Sat Oct 27 23:03:09 PDT 2007


In message: <4722BDBE.5030408 at incunabulum.net>
            Bruce M Simpson <bms at incunabulum.net> writes:
: It seems a team in Iceland succeeded in making Linux C++ enabled:

Most people on this list haven't had experience with eC++.  In this
environment, a number of the features of the language are omitted to
be better suited to the embedded environment.

If it were up to me, I wouldn't bother with supporting exception.
They are one of the areas that are abused that have dire consequences
when abused (uncaught exceptions are evil, for example).  Rtti was
also omitted from eC++ as well.  These things help debloat the
language and can be used to good effect.

The kernel isn't a general purpose computing environment.  However,
C++ features would help in a great many cases.  There's already some
C++ elements in kobj, which help us in our implementation of newbus.

However, as time passes, more and more things are written in other
languages, including C++.  Many of these other languages are totally
unsuitable for the kernel.  Python, Ruby and Perl, while great
scripting languages, will never be in the kernel.  The old vmkernel.el
joke will never happen either (although there's been rumors of an
in-kernel compiled-lisp interprater floating around).  C++ support,
driven by people's experience with OS X, will continue to be a highly
desired feature.

At this stage, I think if someone came forward with patches, that
could be optionally installed, there would be support for including
them.  Maybe installed as a port.  There's been little to no support
for integrating C++ into the kernel for general use by the base
system, so new C++ drivers or subsystems would meet extreme
resistance.  However, having C++ support would allow the extreme
FreeBSD users to suffer or benefit from C++ in their kernels without
having to reinvent the base wheel.  I think the arguments are strong
enough for this, but not so strong as to accept it into the base at
this time without some compelling proof that it can be done, in
FreeBSD, without extreme pain.

Warner


More information about the freebsd-arch mailing list