2 ms·
I actually disagree with that. Exceptions have their problems when used for error handling, but they are a great solution for error not-handling, and normally i
by im3w1l 3y ago
I actually disagree with that. Exceptions have their problems when used for error handling, but they are a great solution for error not-handling, and normally index out of bounds is a bug that you can't / don't want to recover from. Exceptions will bubble up and unwind the stack, cleaning things up by running destructors. In other languages they will also display a nice little backtrace, though in c++ it seems thats not typically done for reasons that are beyond me.
- kbolino 3y agoYeah, I've got more experience lately with Go and Rust, where as you say, error not-handling is an acceptable fallback for unintentional mistakes via panic. I'm not sure what the practical differences are between C++ exceptions and Rust/Go panics though, apart from the lack of backtrace.