4 ms·
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 (r
by twoodfin 14y ago
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.