public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Bart Samwel <bart@samwel.tk>
To: root@chaos.analogic.com
Cc: Ashish sddf <buff_boulder@yahoo.com>,
	Linux kernel <linux-kernel@vger.kernel.org>
Subject: Re: Compiling C++ kernel module + Makefile
Date: Mon, 19 Jan 2004 22:24:39 +0100	[thread overview]
Message-ID: <400C4B17.3000003@samwel.tk> (raw)
In-Reply-To: <Pine.LNX.4.53.0401191521400.8389@chaos>

Richard B. Johnson wrote:
[...]
> I stand by my assertion that anybody who develops kernel
> modules in C++, including MIT students, is arrogant.
> 
> Let's see if C++ is in use in the kernel. At one time, some
> of the tools that came with it were written in C++ (like ksymoops).
> 
> Script started on Mon Jan 19 15:19:33 2004
> $ cd /usr/src/linux-2.4.24
> $ find . -name "*.cpp"
> $ exit
> exit
> Script done on Mon Jan 19 15:20:25 2004

Just so that you know, the extension .cpp is typically used by Windows 
C++ programmers, on most other environments the usual extensions are .cc 
and .C. If you look for *.cc you find scripts/kconfig/qconf.cc, so the 
kernel toolset is not completely C++-free. Not that all of this matters.

> Well, perhaps the kernel developers were ignorant. They didn't
> write anything in C++. Maybe they were just too dumb to learn the
> language?

It seems you you assume I'm an arrogant Bjarne-hugging C++-lover. Where 
did you get that? It's probably in your mind, where everyone who 
suggests C++ is a Bjarne-hugging C++-lover. I'M NOT IN THE C++ CULT. I'M 
NOT SAYING THAT EVERYONE SHOULD PROGRAM IN C++. Hope this came across, 
you are now officially declared deaf. ;)

> Maybe there is another reason:
> The kernel development languages, as previously stated, were
> defined at the project's inception to be the GNU C 'gcc'
> compiler's "C" and extensions,  and the 'as' (AT&T syntax)
> assembler. Anybody can search the archives for the discussions
> about using C++ in the kernel.

Yeah, definitely. I fully agree that it's not wise to use C++ *in the 
base kernel*. The Linux project needs to maintain overall consistency, 
and one of the means of doing that is using a small, well-defined 
toolset -- in this case, as and gcc. Any large project needs language 
and coding standards.

But we're not talking about the base kernel here. We're not talking 
about migrating the kernel to C++, or even modules that are part of the 
Linux kernel source. We're talking about *independent modules*. The 
kernel exports a module interface, and any binary driver that correctly 
hooks into the interface of the running kernel (using the correct 
calling conventions of the running kernel) and behaves properly (e.g., 
doesn't do stack unwinds over chunks of kernel functions etc.) can hook 
into it and do useful work. If somebody has decided that it would be 
worth it for his project to use C++ (without exceptions, rtti and the 
whole shebang) then so be it, why should you care? It's just binary code 
that hooks into the module interface, using the correct calling 
conventions. It doesn't do dirty stuff -- no exceptions, no RTTI, 
etcetera. It compiles into plain, module-interface conforming assembler, 
that can be compiled with -- you guessed it -- 'as', the AT&T syntax 
assembler. Yes, they're taking a risk. Their risk is that C++ can't 
import the kernel headers, or that C++ might someday need runtime 
support that cannot be ported into the kernel. It's *their risk*, not 
yours. Then why do you have a reason to get religious about this? 
They're not submitting this stuff for inclusion in the Linux source!

> Any person, or group of persons, who is smart enough to
> actually write some kernel code in C++, has proved that
> they are not ignorant. Therefore, they have demonstrated
> their arrogance.

This logic is faulty. It is built upon the premise that (ignorant || 
arrogant). Not listening to warnings of others is not a sign of 
arrogance per se, it is only a sign of the presence of a different 
opinion. It assumes that the kernel developers are always right, and 
that everybody who is smart should listen to them, on penalty of being 
arrogant. Yes, these C++-loving people may be wrong (or they may not 
be), but that does not _automatically_ make them arrogant, they may 
simply have a different opinion -- right or wrong. If they are wrong, 
they are not arrogant, but simply *stupid*. If they are right, they are 
not arrogant either -- they may be arrogant *about it*, but that's just 
a manner of behaviour, and it's up to them if they behave in this way or 
not. Kernel developers do not prescribe what people can do with the 
kernel, this is part of the essence of "free". And as a result of that, 
they do not have the right to declare people arrogant when they do not 
listen. They have the right to *call* them that, but the only result of 
that is that all discussion on matters like these are smothered in 
religious wars. And that's a pity.

-- Bart

  reply	other threads:[~2004-01-19 21:25 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-16 21:09 Compiling C++ kernel module + Makefile Ashish sddf
2004-01-16 22:07 ` Richard B. Johnson
2004-01-17 12:59   ` Bart Samwel
2004-01-19 13:46     ` Richard B. Johnson
2004-01-19 17:40       ` Bart Samwel
2004-01-19 18:39         ` Richard B. Johnson
2004-01-19 20:02           ` Bart Samwel
2004-01-19 20:37             ` Richard B. Johnson
2004-01-19 21:24               ` Bart Samwel [this message]
2004-01-20 15:20                 ` Richard B. Johnson
2004-01-20 17:34                   ` Zan Lynx
2004-01-20 18:10                     ` Richard B. Johnson
2004-01-20 13:38                       ` Thomas Lahoda
2004-01-21  2:24                       ` Michael Clark
2004-01-20 18:16                     ` Chris Friesen
2004-01-21 17:01                 ` Giuliano Pochini
2004-01-21 17:16                   ` Bart Samwel
2004-01-20  0:59               ` Robin Rosenberg
2004-01-20  6:46                 ` Linus Torvalds
2004-01-20  7:32                   ` Robin Rosenberg
2004-01-20 10:46                   ` Bart Samwel
2004-01-20  5:29         ` Valdis.Kletnieks
2004-01-20  9:48           ` Bart Samwel
2004-01-16 22:40 ` Sam Ravnborg
  -- strict thread matches above, loose matches on Subject: below --
2004-01-19 13:21 Petr Vandrovec

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=400C4B17.3000003@samwel.tk \
    --to=bart@samwel.tk \
    --cc=buff_boulder@yahoo.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=root@chaos.analogic.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox