3 ms·
C++ is a type-safe language (unless you use C-features like void*, which you shouldn't in C++) it is high-level (thanks to templates likely more high-level than
by johannes1234321 10y ago
C++ is a type-safe language (unless you use C-features like void*, which you shouldn't in C++) it is high-level (thanks to templates likely more high-level than many others). If you think of C++ as "C with classes" then you can mix them, but C++ evolved quite a lot with C++11 and following standards and implementations.
- kbart 10y agoI somewhat agree with that, but unlike in most other modern languages, type-safety is not enforced, thus you can't call it a pure type-safe language even though you can write programs in type-safe way. Same with low/high level -- you can use C++ as low level (C with classes) or as high level according to modern C++ standards (C++11, C++14) and best practices. There's no strict classification, I just wanted to highlight C++ similarities with C.
- johannes1234321 10y agoThe C++-fan would say you have the tools to ignore type safety, so you can opt-out. But that's of course a matter of perspective. A good, modern, tutorial should only teach type-safe tools to beginners.
- KKKKkkkk1 10y agoSpeaking of type safety, has modern C++ solved the object slicing problem yet?
- TheCoelacanth 10y agoYes, they're called references.
- dbaupp 10y agoThere's too much undefined behaviour for even modern C++ to be considered type safe: a dangling reference or invalidated iterator allows you to break it easily, accidentally. (Even "opt-out type safety" is a stretch, opt-in-with-extra-tooling-and-tests seems more appropriate.)