4 Comments
Jan 8, 2023Liked by Šimon Tóth

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.

Expand full comment
Jan 7, 2023Liked by Šimon Tóth

great overview!!

Expand full comment

Nicely done.

Expand full comment

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

Expand full comment