| ▲ | bluGill 2 days ago | |||||||
What you wrote is historically correct, but new analisys shows exceptions are faster that error codes if you actually check the error codes. Of course checking error codes is tedious and so often you don't. Also is micro benchmarks error codes are faster and only when you do more complex benchmarks do exceptions show up as faster. | ||||||||
| ▲ | jandrewrogers 2 days ago | parent [-] | |||||||
The performance benefits of exceptions are not borne out in practice in my experience relative to other error handling mechanisms. It doesn't replicate. But that is not the main reason to avoid them. Exceptions have very brittle interaction with some types of low-level systems code because unwinding the stack can't be guaranteed to be safe. Trying to make this code robustly exception-safe requires a lot of extra code and has runtime overhead. Using exceptions in these kinds of software contexts is strictly worse from a safety and maintainability standpoint. | ||||||||
| ||||||||