by delegate · 10y ago · 0 comments
Although technically a superset of C, C++ has constructs and paradigms which make you think in totally different ways.
In fact C++ introduces many language features which (should) protect programmers from 'C' mistakes in their C++ code.
For example, in modern C++ you shouldn't manage memory directly, but use smart pointers and containers. You can, but you shouldn't.
And there are dozens of such recommendations. Which is the right approach, imho. You can still do the low-level dangerous stuff if you feel brave, but officially you should stick to the 'safe' paradigms that the language now offers.
However, the paradigms that C enforces on you are the paradigms of how to do things fast. You wear no protection so you are much more nimble, but much more vulnerable at the same time. Which is good for some types of projects, but not for all.
`auto` has very different meanings in both languages, and you can't omit the return type of an int-returning function in C++
Also, C++ doesn't allow implicit casts from void* to any pointer type, which is a common C idiom.
Sure they are. C/C++ are often cobbled together in a sense that they are both low level, non-memory safe and non-type safe languages, as opposite to high level, safe, memory managed (aka "modern") languages.