On Maw, 2006-04-25 at 00:03 +0300, Avi Kivity wrote:Maybe not mathematically, but I can try to hand-wave my way through.
Alan Cox wrote:
I think it's easy to show that the equivalent C++ code would be shorter, faster, and safer.
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 lotYou might keep C strings (or something similar) for the vfs paths and use C++ strings for non performance critical code.
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.