3 ms·
Nobody seems to mention this when comparing, but code to handle the case of getting a bad error code is almost always very poorly exercised: therefore, buggy.
by ncmncm 6y ago
Nobody seems to mention this when comparing, but code to handle the case of getting a bad error code is almost always very poorly exercised: therefore, buggy.
That is in contrast to the code run during an exception, the destructors, which run all the damn time.
If you do make the effort to test your error-handling code, that is a significant expense on top of the reduced performance. Maintaining those tests as the code changes from under them is another expense.
- p0nce 6y agoExactly this. It's hardly ever mentionned, but as error paths are less tested, code that is written without exceptions (and RAII) will be wrong a lot more often.
- CodesInChaos 6y agoDestructors/RAII and finally statements work just as well when returning error codes as they do with exceptions.