3 ms·
> how do you handle a logic error in your code? does that even make sense philosophically? In some contexts sure, there's not really much you can do, but in ma
by MaxBarraclough 2y ago
> how do you handle a logic error in your code? does that even make sense philosophically?
In some contexts sure, there's not really much you can do, but in many others it's perfectly clear. In a request-oriented system like a web server, you stop the failed request-handling logic and send back an error code. Exceptions can make this quite natural to implement. Much better than letting the error go undetected, invoking undefined behaviour, and risking mishandling of future requests, or perhaps even a serious security vulnerability.
> Yet you could also enable bounds checking for debugging on operator [] or use address sanitizer.
I'd flip that around. Why bother with additional platform-specific cleverness when the standard library already gives you what you're after?