4 ms·
"C++ has optional and complicated things that incur costs only when you use them, so let's not even have dtors" is...not a good look, I think.
by eropple 10y ago
"C++ has optional and complicated things that incur costs only when you use them, so let's not even have dtors" is...not a good look, I think.
- EGreg 10y agoGotta love those non virtual destructors which only clean up the base class. And the ambiguity about whether you're going to call a type conversion operator or a copy constructor when assigning A a = b. Because you know, it's all super clear.
- eropple 10y agoWho said anything about inheritance? Like, at all? That is yet another feature you pay for only when you adopt it. You can pick one of two problems: you can agree upon a subset of C++ to use or you can expect your C developers to be perfect all of the time (while having fewer, if any, ways to express correctness). Dragging out additional things that are not part of your subset of C++ doesn't help formulate an argument against this.
- EGreg 10y agoI agree about C needing memory management and exceptions. That's why I said I liked C++ when that's all there was. Classes were nice sumyntactic sugar. But the language jumped the shark starting with C++0x
- eropple 10y agoC++0x adds nothing you are obligated to use, though. No sharks have been jumped unless you choose to strap on some skis and rent a boat. (Meanwhile, with move semantics and unique_ptrs, C++14 is actually way nicer as far as memory management goes than that 2000-era C++ was.)