4 ms·
It's definitely getting easier, but I still wouldn't even consider C++ without valgrind or similar watching over my back; and I've been writing C++ since 1995.
by andreasgonewild 9y ago
It's definitely getting easier, but I still wouldn't even consider C++ without valgrind or similar watching over my back; and I've been writing C++ since 1995. Accessing a variant value as the wrong type, dereferencing empty smart pointers and accessing non-existing elements in collections and many many more cases will still segfault; and I don't expect that to change since it lacks that level of security by design. That being said, it's still the most pragmatic language around; the only language that allows me to choose my own level of crazy.
- farunen 9y ago@andreasgonewild: "It's definitely getting easier, but I still wouldn't even consider C++ without valgrind or similar watching over my back" That we still need such tools to help the compiler in 2017 tells me that programming languages haven't advance much. (moderators: yes I know, downvote and disable the account, cause any kind of disagreement is considered a micro-macro-micro-aggression, not to mention any attempt at humor).
- futurix 9y agoExactly! C++ is a language where you are free to choose level of safety. None of your examples are a fault of the language - it is a fault of developer not doing necessary safety checks.
- johannes1234321 9y agoThe point is: some languages have capabilities to take some classes of errors out. A language with GC and heap-allocation only makes it hard to get access-after-free-style errors. Languages with bounds checks on all elements reliably crash (throw an exception) instead of showing "random" behaviour on bad reads. Of course all of that comes with a cost, but for many domains that works out ...
- iainmerrick 9y agoI don't find null pointers any worse in C++ than in Java or C#. Seg fault or a NullPointerException that you can't do anything useful with, take your pick. Buffer overflows, now, those are a special pain in C and C++. In many applications you don't need to work with arrays directly, though; and when you do need to do a lot of stuff with arrays, you probably also need it to run fast.