Re: Linux kernel modules development in C++

From: Martin Dalecki (dalecki@evision-ventures.com)
Date: Thu Sep 28 2000 - 13:31:05 EST


Ragnar Hojland Espinosa wrote:
>
> On Thu, Sep 28, 2000 at 01:45:40AM +0200, Igmar Palsenberg wrote:
> > Some arguments why not to use it in the kernel :
> >
> > - C++ gives overhead. With something like a kernel that's unwanted.
>
> You pay for what you use, no less no more. C++ compilers don't generate
> bloated code `per se' but, yes, it's easier to make mistakes that degenerate
> into bloatedness.
>
> > - Things like exception handling is hard to do in a kernel.
>
> You don't need it. And if you don't use it you don't pay for it.
>
> > - The're a lot more people that know C than C++
>
> Let's put it the other way... there aren't many people who know
> C++ around. Well, there are less people who understand the kernel. Then,
> maybe, to make it more accessible, we should dumb it down.
>
> > And I probably forgot a few :)
>
> Sure :)
>
> Someone mentioned they preferred C because they knew exactly what the
> compiler would be generating. I wonder if they got this knowledge in some
> magic way, and what makes them think that they couldn't learn what C++
> compilers do (at least G++)

Simple: The fact that G++ is constantly changing what it's generatign
even
between minor numbers:

1. Calling conventions.
2. Name mungling.
3. Construct semantics.
4. Run time support (stdio and STL).
5. New features here and there...

and so on and so on...

You just can't follow them all in case you are not interrested in
becoming a compiler developer yourself!

And then there are tons of hidden code generation there:

1. Constructors/Destructors
2. Templates !!!!
3. Operator overloding - which can be very successfully used to hide
   the true semantic of the operators from the code reader. In esp. copy
   contructors and such...
4. Hidden inheritance due to header mess...
5. Sic and fragile semantics of all language components!

> Of course, yes, I do agree that if the kernel is in C and putting in C++
> requires more than some little localized glue or similar, C++ shouldn't go
> in.
>
> But I'll never understand this C++ aversion.

C++ is fine for GUI coding and such but it's no good in case you really
need full controll of the underlying machine - and the only way to
get this is to have full controll of what's generated by the compiler.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Sep 30 2000 - 21:00:22 EST