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

Alan Cox (alan@lxorguk.ukuu.org.uk)
Thu, 7 Jan 1999 22:46:32 +0000 (GMT)


> From what Alan says, adding support for C++ exceptions within the kernel is a
> matter of the code overhead needed by the language feature and not a restriction of
> kernel coding conventions. Of course, the obvious consideration is the cost/benefit
> analysis and I readily agree that it would be unlikely that such additional code
> bloat could be justified at this time.

For exceptions the bloat is measurable. For __new and __destroy the bloat is
tiny. In both cases you should be able to contain it in your module.

> 2. The cost of supporting/implementing new features in large systems will
> REQUIRE a language that better enforces their design models.

I actually trust Linus to enforce models far better than a compiler. Firstly
Linus has a "why" button which design tools often lack, and secondly a sharp
eye and a good sense of code beat any bit of software I've seen. C++ isnt
that bad here, its very easy to say "trust me" to it. With many more
formal languages there isn't a "go away Im brilliant" option.

Another big C++ problem with an OS kernel is that it tends to hide things
like memory referencing. With C you can accurately see where you have cache
issues, where there are going to be excessive reloads and also see clearly
where objects are dereferenced which is very important for SMP.

Alan

-
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/