Re: kbuild & C++

From: Bernd Petrovitsch
Date: Wed Sep 07 2005 - 06:45:34 EST


On Wed, 2005-09-07 at 11:21 +0200, Esben Nielsen wrote:
> On Tue, 6 Sep 2005 Valdis.Kletnieks@xxxxxx wrote:
>
> > On Wed, 07 Sep 2005 00:20:11 +0200, Esben Nielsen said:
> >
> > > Which is too bad. You can do stuff much more elegant, effectively and
> > > safer in C++ than in C. Yes, you can do inheritance in C, but it leaves
> > > it up to the user to make sure the type-casts are done OK every time. You
> > > can with macros do some dynamic typing, but not nearly as effectively as
> > > with templates, and those macros always comes very, very ugly. (Some say
> > > templates are ugly, but they first become ugly when they are used
> > > way beyond what you can do with macros.)
> > >
> > > I think it can only be a plus to Linux to add C++ support for at least
> > > out-of-mainline drivers. Adding drivers written in C++ into the mainline
> > > is another thing.
> >
> > http://www.tux.org/lkml/#s15-3 Why don't we rewrite the Linux kernel in C++?
>
> I can't see it should be _that_ hard to make the kernel C++ friendly. At work
> I use a RTOS written in plain C but where you can easily use C++ in kernel
> space (there is no user-space :-). We use gcc by the way.

Of course. Probably the easiest way is
-) to provide a pure C interface (read: write functions with C linkage
that call your C++ stuff) to your C++ stuff
-) compile your C++ sources separately
-) kill all not-existing features needed by the linker and other
programs (or implement them in the kernel/your module).

> PS. Do the above people break GPL by forcing people to accept a
> license-agreement before downloading a patch to the kernel? Shouldn't they
> provide a direct url?

As long as the license agreement does not conflict with the GPL, I can't
see a legal problem. And you can download their source - which is
probably GPL - and put it online wherever you want.
It is inpolite though, IMHO. But it is also inpolite to top-post, break
threads, include meaningless disclaimers, etc.

Bernd
--
Firmix Software GmbH http://www.firmix.at/
mobil: +43 664 4416156 fax: +43 1 7890849-55
Embedded Linux Development and Services

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/