Re: Compiling C++ modules



Al Boldi wrote:
Christer Weinigel <christer@xxxxxxxxxxx> wrote:

eCos is nice enough -- because it's mostly C :)

And those parts that are C++ (from a 2 year old eCos dist) won't
compile with a modern g++.


C++ is OO,

But not a very good implementation of it :-(.

and OO is great! OO is the natural way of doing things, and allows one to concentrate on the issues at hand, while leaving the nitty-gritty to the compiler to decide.

And this is the problem, as kernel development is highly sensitive to compiler output, and which is why there are parts written in asm and others in C.

So rewriting C with C++ would be as dumb as rewriting asm with C.

But there may be certain higher level parts in the kernel that could benefit from rewriting C with C++, much the same as lower level parts have benefited from rewriting them in asm.

So we have a situation like this:

low-level written in asm when needed

main-level written in C mostly

high-level written in C++ when needed

Note though, C++ is not currently viable for kernel development, due to its enormous overhead generated by immature compiler technology. Once this has matured, there should be no problem.


--
"Just how much can I get away with and still go to heaven?"


Just know that HE is one and only one.

Thanks!

--
Al

-
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/


--
Peter Williams pwil3058@xxxxxxxxxxxxxx

"Learning, n. The kind of ignorance distinguishing the studious."
-- Ambrose Bierce
-
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/



Relevant Pages

  • Re: Compiling C++ modules
    ... nitty-gritty to the compiler to decide. ... So rewriting C with C++ would be as dumb as rewriting asm with C. ... Vector operator+(const __vr that) const ...
    (Linux-Kernel)
  • Re: Compiling C++ modules
    ... nitty-gritty to the compiler to decide. ... So rewriting C with C++ would be as dumb as rewriting asm with C. ... Note though, C++ is not currently viable for kernel development, due to its ...
    (Linux-Kernel)
  • new codegen thoughts...
    ... C was parsed into an XML-based AST; ... the ASM was assembled and linked. ... compiler frontend to the codegen to make this work). ... CPU registers will be mapped to the tvars behind the scenes (the AST ...
    (comp.compilers)
  • optimizers are overrated
    ... I started learning ASM not long ago to improve my understanding of the ... The first function uses a typical C style loop to ... which one is more efficient all you guys would reply "the compiler will most ... so my "write C like ASM" optimization worked. ...
    (comp.lang.c)
  • Re: Hiring Advice
    ... I still need to know ASM or at least know how to read ... what the Compiler does to figure out what went wrong. ... If, instead, you stuff all your globals into a struct, then the compiled code only fetches the base address from the constant pool once, then uses the free constant offset to get to the individual parts. ... And so the idea that you can get away without any ability to work at the assembly level is worrisome, and that the schools seem to be teaching it now as a given even more so. ...
    (comp.arch.embedded)