On Mon, 19 Jan 2004, Bart Samwel wrote:[... lots of text ...]
I'm not familiar with the exact history of the project, but I expect
that they decided to do C++ because the model they try to express is
best modeled using C++. This design decision can be debated, because it
is perfectly feasible (albeit with a lot more work) to implement an OO
model in C. In fact, I have helped to implement a similar framework (the
OKE CORRAL) which was written completely in C. But, the fact of the
matter is, this useful (but huge) kernel module is there now (and it has
been here since the early 2.2 kernels), and it was not written just to
"prove" that it could be done, but because C++ seemed at the time to be
the best language for the job. The start of this project may very well
predate the many times that this was hashed-over on the LKML
(disclaimer: I wasn't there, so I don't know). You refer to "what can
only be" the arrogance of the writers, yet continue by claiming:
> I'd suggest that you spend some time converting it to C if you need
> that "module".
and
> The conversion will surely take less time than going through the
> kernel headers looking for "::".
Excuse me, but before calling somebody else arrogant, I would suggest
that you might want check whether you're not calling the kettle black.
It's not a sign of modesty when you assume without a trace of doubt that
a module (that happened to have been developed over the course of four
years by a team of people at MIT) is just a "\"module\"" and that it
will take less time to port it to C than to make the kernel headers
parse in a C++ extern "C" clause. In addition, imagine how you would
feel if somebody referred to your work as a "\"module\""! The fact that
you "can't imagine why anybody would even attempt to write a kernel
module in C++" may just as well be due to a lack of imagination on your
side, but in your statement I detect no trace of a doubt. And _yes_ you
may very well be right about their initial decision being stupid (and
you might not be -- I don't know), and _yes_ you are probably right
about the whole thing being hashed-over many times (I don't know -- I
wasn't there), and _yes_ there are people out there who would do
anything just to prove they can do something others think is impossible
or just filthy. So, yes, there _may_ be a point to what you're saying.
_May_. I'm not saying you're wrong, and I'm not saying you're right.
What I'm saying is that simply assuming that any C++ module is nothing
more than a few lines of (de)glorified C and accusing the writers of
being arrogant just because they wrote a kernel module in C++ is, in my
opinion, jumping to conclusions based on
technical-preference-turned-prejudice (at least, that's how it seems),
and it's not very polite either.
The possibility that something may have been written by some MIT people
can't change the fact that C++ is not the tool that should have been
used within the kernel. I once worked on a project at Princeton. That
doesn't make me know anything about Relativity. Einstein didn't rub
off due to some proximity effect.
If the "MIT Team", as you so state, had actually inspected some
kernel code, and actually understood what a Linux/Unix kernel does,
then learned persons could not possibly have selected C++ for this
project.
If you review the project, you will probably also find that a
large percentage of the code should have been implemented in
user-mode (a daemon, or several). That's where C++ really shines.
However, it wasn't. Which, to me, means that the developers
were either clue-less or, once somebody actually figured out
how a kernel works, it was way too late to change (an all to common
problem).
The number of persons who worked on a project does not affect the
correctness of the tools nor the architecture chosen. Facts are
not democratic. You can't vote them into or out of existence.
Unfortunately, this is how flame wars get started (as can be seen by the
slightly agitated tone this message has taken, sorry about that! :) ).
Just to make this clear to everyone: I'm not trying to instigate a flame
war here about C vs. C++, as I don't really have an opinion on that
subject. This posting has to do with my preferences w.r.t. personal
style, and nothing with my technical preferences.
This is not about preferences. Most software engineers wish that
everything could be done using the first language they learned. Once
they try to write a state-machine in FORTRAN (my native language), they
begin to understand that there are other tools more suited for the
job. Unfortunately, especially for students at well-known universities,
learning a language often opens the door to a cult. I remember
the "Pascal cult", the "forth cult", the "C cult" the "C++ cult", and
now the "C# cult". Next year there may be "D" and the cycle will
continue.