3 ms·
From my experience, if you need to write many exception handlers then you have a problem in your design as you are using exceptions where you should have used e
by vitaut 11y ago
From my experience, if you need to write many exception handlers then you have a problem in your design as you are using exceptions where you should have used explicit control flow. There is nothing fundamentally wrong with the exceptions and they are used in most modern languages, not only C++.
- wvenable 11y agoI completely agree; the entire time I'm reading this I couldn't help but feel this was misunderstanding the use of exceptions. The stated design goal is that the project "never fail and never exhibit undefined behaviour" yet exceptions are exactly for undefined behavior. If you can't allocate memory, if your function is called with arguments that it cannot possibly interpret, or that a fully expected network connection has failed and cannot recover. Those are exceptions. For all your defined behaviors, you can control just as described in the article without exceptions. There is clearly too many exceptions (and handlers) in the first case and way too few in the second case.