3 ms·
Calling the output of a C++ compiler a black box and saying it's not a good idea to use C++ for that reason, and implying that C is better because you mostly kn
by phaedrus 16y ago
Calling the output of a C++ compiler a black box and saying it's not a good idea to use C++ for that reason, and implying that C is better because you mostly know what the assembly output will be, boils down to an argument against abstraction.
There is a limit to what a hacker can keep in his head at once. You may believe your limit is high, but it does exist. If you eschew abstraction, there is a class of programs you cannot write because you can't keep the complexity managed. This is why it irks me when I see arguments against abstraction - they are short sighted.
Now, there are some perfectly good concrete examples of things C++ compilers do which may not be a good idea in kernel code. For instance, C++ exceptions can cause trouble when the stack alternates between C++ and C frames.
- lobster_johnson 16y agoWell, the whole point is that C contains so few abstraction in the first place that most dedicated developers can have a mental model of the mapping between language and machine. There are very few abstractions that don't correlate exactly to machine language in some known way. C is all about subroutines (functions), jumps (function calls), pointers and quantities that map directly to registers (int, long) — for the most part a fairly thin veneer on top of modern CISC/RISC machine code. For those abstractions (such as the call stack) that are essentially black boxes, there is the C ABI, which explicitly defines much of the underlying structure.