3 ms·
If Linux kernel code looks like UNIX C code from 25 years ago, I'd argue it is C which hasn't aged well. C++'s true merit lies in its flexibility to evolve wit
by codex 14y ago
If Linux kernel code looks like UNIX C code from 25 years ago, I'd argue it is C which hasn't aged well.
C++'s true merit lies in its flexibility to evolve with the latest understanding of how to write good, abstract code with little runtime penalty, IMHO.
- rayiner 14y agoC++ never really lets you enjoy your abstractions because they're always so leaky. Low-level implementation details are always percolating to the surface. In practice I don't find C++ code any more readably abstract than similar C code. A really good example is libfirm versus llvm. The former is in C< the latter is in C++. They're both roughly the same order of magnitude in size (at least the core). They're both highly optimizing compilers. I find the former far more clear and readable. I personally find C++'s abstractions to be of questionable value. YMMV.
- waps 14y agoThat's not really a fair comparison as libfirm implements a much simpler problem : C compilation. Llvm implements generic compilation with implementations for C, C++, Objective C, Objective C++, Ada, D, Fortran, Haskell, Java bytecode, CIL, MacRuby, Standard ML. Of course there is a difference in complexity.
- 4ad 14y agoCompletely untrue. LLVM implement compilation for LLVM bytecode. Clang and other compiler that translate C++ or any other language to LLVM bytecode are not part of LLVM.
- qznc 14y agoIt is not that hard to convert Firm to LLVM or vice versa. If you can read german, a student once implemented this [0]. This allowed libfirm to compile C++ and Fortran code using the corresponding LLVM frontends. Libfirm (with liboo extension) does not support exceptions, but apart from that there should be little difference in features. For example, there is an experimental frontend for Java bytecode [1]. It compiles ahead-of-time, like gcj. [0] http://pp.info.uni-karlsruhe.de/uploads/publikationen/liebe10studienarbeit.pdf http://pp.info.uni-karlsruhe.de/uploads/publikationen/liebe1... [1] https://github.com/MatzeB/bytecode2firm https://github.com/MatzeB/bytecode2firm
- qznc 14y agoHey, someone who knows libfirm. :) Fun fact: A full build of libfirm is faster than LLVM's configure. The compilation process is one of C++ greatest weaknesses. Since the iteration speed (change-compile-runtest) is a significant productivity factor, C can be more productive than C++. On the other hand, D shows that a language with a comparable feature set to C++ can be compiled much faster.
- rayiner 14y agoI just compiled libfirm and cparser last night on the train home. Cparser compiled so fast I thought the build was broken. Indeed, C++ compile times are unreasonable even with Clang.