What does C++ add to C?
- What features of the language are the Clang/LLVM projects, the parts of GCC that are being written in C++, chromium, and any others all taking advantage of? What features are they avoiding?
What does C++ add to C?
Not? I would say it's not worth if you performance is not an issue for you. (Follow the double negatives.)
Because despite academic efforts such as Singularity, there's not a single mainstream OS where drivers can be written in a high-level language.
Note that anything that can be done in C++ can also be done in C, but some things are a lot easier in C++.
Like all sophisticated and powerful things there is a price to be paid to succeed in C++.
So if you're sloppy with memory, poor at design, don't need fast programs, or have no self discipline, then please don't learn C++. There is always Java or C#.
meta programming? templates?
like with C you get performance, but the code looks horrible. with the high level languages you get nice code but there is less flexibility to make the fastest possible code.
with c++ you can do both? you can freely make anything as fast as it could be made in C, but native object orientation, and templates/operator overloading ect makes it so you can write fairly nice looking code too. indeed, you can make it so it is neat and fast.
I have never really found it more of a pain to write stuff in c++ than in a higher level language. the trick is having good libraries.
My two cents:
C++ is far from elegant, and in many cases, elegance is frowned apon. Anyone ever told you to use static_cast
instead of C-style casting? Anyone ever told you not to use namespace std;
? C++ has a lot of features, but doesn't tend to have many important language features (such as closures, which are formally proven to be the best thing since sliced bread).
Why do people use C++, then? Well, it's performance-focused, making it a good choice when you need speed. It has classes, namespaces, and templates, so it's a good choice when you want better code organization, but still need to use "C" for some reason. Also, it has the Boost library, which I've heard is really good for getting work done.