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

Tim Smith (tzs@tzs.net)
Sun, 10 Jan 1999 21:23:32 -0800 (PST)


On Sat, 9 Jan 1999 tytso@mit.edu wrote:
> Fundamentally, there are a lot of people out there who can't write
> good C++ code, and bad C++ code is infinitely worse than bad C code.

The problem is that many people seem to have the strange notion that if
they use C++, they should try to use all of that. If you can avoid
picking up that silly idea, it is a fine language for almost all
application development. If you limit yourself to just using those
parts of C++ that are nearly identical to C, except allowing yourself
to use a good string class, STL, and constructors/destructors in your
structs, and completely ignore things like exceptions, templates,
and inheritence (just treat STL as a black box with some weird magic
syntax), there is little or no risk that your code will be any worse
than your C code, and a very good chance that it will be cleaner and
more robust.

This does require some discipline. You have to be able to resist
things you don't fully understand.

If one has access to a good C++ compiler and library, and if there are
no non-technical reasons one must use C, and if you have the willpower
to only use those things you understand (or those things you can treat
as a black box, like STL), I can't see any excuse for using C.

--Tim Smith

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