> C has no advantage over C++ when it comes to good code design or
efficiency. That is in the hands of the developer.
This is false in the first sentence, but the second is always true. If you
have a group of junior device driver developers, the limited environment in
“C” can help keep them from shooting themselves in the foot. Cobol is even
better at allowing almost anyone with minimal skills to be a coder, though
it takes a long time for them to become a programmer.
My point is that people seem to be saying that if their file is labeled
“.cpp” there code will somehow be tainted and neither clear or
efficient. Where do you draw the feature line at? Since c++ is a
super-set of c, which features are the ones that don’t belong in the
kernel? You can’t tell me none of them.
I use C++ in my device drivers because it makes sense. I use the .cpp
extensions even if the code is still pure “C” because the latest Microsoft
compilers do a better job of catching errors. Since the stack is so limited
in kernel mode, the full capabilities of C++ exception handling don’t belong
and aren’t supported by Microsoft. Passing large data items on the stack is
another bad idea in either “C” or “C++”.
Does that mean if I prefer the power/features of
a c++ compiler then by definition I don’t understand the language? I have
met so many C programmers that had zero clue about how the language works
or describes what is happening in the hardware. One of my favorite
arguments that I heard in person: “There are no dynamic arrays in C”. I
spent hours trying to explain that “pointer” and “array”
interchangeable. He left unconvinced, but said he would study it further
(he said it was a non portable compiler exploit or some nonsense).
I have been in environments, government, where you are give some people who
the “system” says are programmers. You have a job to do and they are your
resources. Sometimes you just have to apply the KISS principle even in your
choice of language. Luckily in today’s civilian job environment, you can
get rid of the non-performers, but it much more difficult in the military or
civil service. It takes a supervisor at least a year to get a civilian
fired for incompetence and most supervisors don’t have that much time to
devote to that. It is easier to get the person promoted or transferred.
----- Original Message -----
From: “Justin Frodsham”
To: “NT Developers Interest List”
Sent: Wednesday, October 23, 2002 7:25 AM
Subject: [ntdev] Re: C++ in kernel. was Re: Batch file for Visual Studio
build,