4 ms·
I've had just a cursory read through the C++ vs C version. Constructors can never fail? Nope, exceptions. If you think constructors should never fail, I think y
by AstralStorm 8y ago
I've had just a cursory read through the C++ vs C version. Constructors can never fail? Nope, exceptions. If you think constructors should never fail, I think you haven't used malloc.
Templates are complex? Compared to preprocessor they're child's play. They're meant to replace most uses of preprocessor.
Other compile time code like constexpr is not mentioned.
Exceptions are not mentioned yet are actually the most complex C++ machinery.
Scope changes are not mentioned but are critical to RAII and other useful anti-bug features.
That you can actually enforce compile time type safety is not mentioned either.
Lambasting the extra visibility keywords when C already has the nastiness of static, extern and inline is very peculiar. They are also essentially type safety measures.
C++ standard library which is strictly superior to C is not mentioned either.
C++ may not be perfect but at least it is being improved. C is the unchanged ancient form where the main gain is that it does not have stack frame unwinding and has trivial ABI.
- RcouF1uZ4gsC 8y agoJust another point of reference. The compiler the author uses to compile C, gcc, is actually now written in C++.
- deleted 8y ago[deleted]
- x0re4x 8y agoNo, GCC is still written mostly in C. Try: git clone --depth=1 https://github.com/gcc-mirror/gcc.git https://github.com/gcc-mirror/gcc.git cloc gcc/gcc
- comex 8y agoThe files have the .c extension, but they're actually C++. …Yes, really. They didn't change the filenames during the migration.