Re: C++ in kernel

Horst von Brand (vonbrand@inf.utfsm.cl)
Tue, 12 Jan 1999 11:51:45 -0300


"Alexander Vlasenko" <ukrgym@ilyichevsk.odessa.ua> said:
> In my opinion C++ can be used as cleaner and safer C.
> C++ has lots of really useful features.
>
> Features that help catch errors early:
> * const pointers
> * private struct members
> * stricter type checking
>
> Features that improve code safety:
> * constant variables (safer than #defines)
> * inline funcs (safer than #defines)

Yawn. This has been in GNU C for ages. The kernel uses these features
extensively.

> I can present code examples for each of these features
> which show C++ superiority over C. Anyone doubts that?

We are _not_ talking ANSI C++ vs. ANSI C, we are talking GNU C vs GNU
C++ (which will be almost exactly ANSI, anyway)

> However thre are things which can screw up kernel.
> These things should be prohibited in kernel code:
> * multiple and virtual inheritance
> * massive function and operator overloading
> * massive conversion ops
> * exceptions
> * templates

I.e., forbid almost everything in C++ that is not in GNU C.

-- 
Dr. Horst H. von Brand                       mailto:vonbrand@inf.utfsm.cl
Departamento de Informatica                     Fono: +56 32 654431
Universidad Tecnica Federico Santa Maria              +56 32 654239
Casilla 110-V, Valparaiso, Chile                Fax:  +56 32 797513

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