Re: Compiling C++ modules

Alan Cox
2006-04-24T21:48:27Z

On Maw, 2006-04-25 at 00:03 +0300, Avi Kivity wrote:
> Alan Cox wrote:
> I think it's easy to show that the equivalent C++ code would be shorter,
> faster, and safer.

I've removed the poor guy from Iomega from the followups, perhaps others
could do likewise

Mathematically the answer is "no you couldn't". You might be able to
argue that a fortran implementation would be faster but not a C++ one.

And for strings C++ strings are suprisingly inefficient and need a lot
of memory allocations, which can fail and are not handled well without C
++ exceptions and other joyous language features you don't want in a
kernel. C with 'safe' string handling is similar - look at glib.

We have to make tradeoffs and the kernel tradeoffs have been to keep C
type fast string handling but to provide helpers in the hope people will
actually use them to avoid making mistakes.