Honest question: Is C++ really worth the complexity over something like C? I'd love to hear people's technology evaluation thought process when choosing C++. To me, C seems far less complicated, while still providing similar levels of performance. I tend to enjoy languages that are small and get out of my way, but if C++ let's me be that much more productive than C, I'd like to make a serious effort to spend more time with C++. What do I gain from C++ that I can't get from C? Is it worth the tradeoff?
The two things I miss most when writing C instead of C++ are RAII and exceptions. Both relocate and consolidate code unrelated to the intention of a function (resource management and error handling, respectively), making it easier to write, read, maintain and debug.
I also find function templates very useful while prototyping: Rather than having to select concrete data types up front, I write a function "as if" I have objects that can perform the operations I need. Now I have a concrete set of requirements (the standards committee calls this a "concept") for my classes. And if I've done it right, whatever abstract idea I've expressed in the function template need never be expressed again.
With some practice, it's remarkable how much C++ allows you to remove redundancy and repetition from your code. All without paying much, if any, of an abstraction tax.
C++ doesn't have to be complicated. It involves such a compoundingly convoluted tool box however that you can create overly complicated contraptions that can explode right in front of you.
There was one fundamental decision made back in the day about the copy constructor, where it takes a const reference as its single argument, that removed logically the C pointer problem. It's still possible to reintroduce it, but it helped prove correctness. In other words you can't make something unless the compiler knows that it's made something. Using an address the compiler has to take your word for it. You can think more contractually, as in say Eiffel, where if there is garbage in its not the programmers doing by definition. At its best it cures some C gotchas. At its worst it can be contrived and misapplied.
Thanks for the honest answer. I have no desire to start a flame war. Having an open discussion about costs/tradeoffs between the two seems helpful. Either way it seems worth my time to learn more about C++, so I can make these assessments for myself. However, it's great to hear other people who've "Been there, done that - here's what I found" from inside the trenches.
With C you are close to the hardware and you don't need as large of a mental model to understand what is going on. It really depends on what kind of problem you are attacking and what level of abstraction you need.