kern/99979: Get Ready for Kernel Module in C++

Oliver Fromme olli at lurza.secnetix.de
Wed Jul 12 16:08:05 UTC 2006


Rick C. Petty <rick-freebsd at kiwi-computer.com> wrote:
 > pfgshield-freebsd at yahoo.com wrote:
 > > 
 > > C++ is the de-facto standard for OO
 > 
 > That is just sad.  So many other languages do a much better job of
 > implementing OO (Smalltalk, Java, Python, even Scheme).

That's true.  At OOPSLA '97, Alan Kay (an OO pioneer) said:
"I made up the term 'object-oriented', and I can tell you I
didn't have C++ in mind."

However, none of the languages you mentioned is really well-
suited for FreeBSD kernel development.

Just for the record, there are a lot of C-like languages
that could be used, in theory.  For example Objective-C
(which has a nice, Smalltalk-like OO implementation, and
it is even completely backwards-compatible to C).  Another
neat language is Cyclone ( http://cyclone.thelanguage.org ),
which is intended to be a "safe" dialect of C, because it
prevents buffer overflows, dangling pointer accesses etc.,
and even has modern features such as pattern matching and
type inference, and it even borrowed a few things from C++
(it uses gcc as the backend and is easy to interface with
standard C code).

Note that I do _not_ imply to actually use any of the above
mentioned languages for FreeBSD kernel programming.  Perso-
nally I prefer to stick with plain C.

 > I'm all for making kernel code free of C++ reserved words (although I'd
 > recommend changing "new" to "new_obj", etc. instead of "_new" or similar).
 > This would allow C++ developers to write drivers and such.  But I don't
 > feel there is any benefit to commit C++ code into the "pristine" kernel
 > source.

The biggest problem is that using C++ code in the kernel
would reduce the number of potential maintainers signifi-
cantly.  It would also make debugging more difficult,
especially for non-experts who try to submit useful PRs.
That's a very important point to consider.

Just my 2 cents.

Best regards
   Oliver

-- 
Oliver Fromme,  secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing
Dienstleistungen mit Schwerpunkt FreeBSD: http://www.secnetix.de/bsd
Any opinions expressed in this message may be personal to the author
and may not necessarily reflect the opinions of secnetix in any way.

"UNIX was not designed to stop you from doing stupid things,
because that would also stop you from doing clever things."
        -- Doug Gwyn


More information about the freebsd-hackers mailing list