What can C do, that C++ cannot do (or can do but with far greater difficulty)?
lol..Well..to be frank agdgdgdgwngo, I thought it was the other way round..I thought C++ was more efficient and advanced when compared to C. Maybe its just my ignorance, but yeah, I sure would like to know this too. I always liked C++ when compared to C. Who would like scanf printf stuff when compared to some neat cin cout :D
The answer is: nothing. C++ compilers can also compile C - as such, C is a subset of C++, and anything that can be done in C can hence be done in C++ :P
C is perceived to be more efficient. C++ is much less used in embedded systems where performance is very important. I don't know whether C++ has been measured to be slower, or whether developers are simply staying with a language that they know how to write fast code in. Example, the VxWorks real time operating system was entirely written in C the last time that I looked.
C isn't exactly a subset of C++: http://stackoverflow.com/questions/1201593/c-subset-of-c-where-not-examples but beyond those features, and the fact that C compilers can be much simpler than C++ compilers, and that "C is faster" (which depends a lot on the compiler), I would say that C++ is far richer than C :(
C++ is a superset of C. Stoussup described as a "better" C. C++ would be slightly slower than C, there are runtime data structures that C++ keeps that C doesn't.
If you're thinking about runtime type ID and exception=handling structures, yes. I can't think of any others. And a good compiler or informed programmer can avoid them. Did you, have other structures in mind?
Those were the ones that I was thinking of. The difference wouldn't be too significant, but I think systems programming will probably lean towards C and applications toward C++.
Join our real-time social learning platform and learn together with your friends!