Just a little nitpick: never, and I mean absolutely never catch exceptions as anything but a `const &`.
Compilers can eliminate most of the boiler plate code for the exception itself if you keep the exceptions nice and const. Don't, and the exception handling turns actually quite costly.
Sure, error codes are still much better, but exceptions ain't that bad either when at least used correctly.
Just a little nitpick: never, and I mean absolutely never catch exceptions as anything but a `const &`.
Compilers can eliminate most of the boiler plate code for the exception itself if you keep the exceptions nice and const. Don't, and the exception handling turns actually quite costly.
Sure, error codes are still much better, but exceptions ain't that bad either when at least used correctly.
great overview!!
Nicely done.
A good read! I have also a blog post on this if you’d like to check out:
https://kemalbektas.dev/c-error-handling-with-style-the-benefits-of-optional-and-expected