|
|
|
|
|
by dgellow
2290 days ago
|
|
As a library writer you can let the caller the responsibility to determine if something is worth throwing an exception for or not. 1. return an error code 2. if the caller consider the issue to require an exception, they will do it themselves You can also have entrypoints to the library that will throw exceptions, and other versions that won't, and let the caller decide what they want to use. Though of course that's more work. Regarding the point of performances, that makes me think of https://news.ycombinator.com/item?id=22483028, discussing "Low-cost Deterministic C++ Exceptions for Embedded Systems". It would definitely be very interesting to see what is now possible if exceptions are cheaper. |
|
So in many cases, if you don't want to compromise on design and architecture, you essentially need to write the entire library twice, or at least the entire interface. Not really a great state.
>discussing "Low-cost Deterministic C++ Exceptions for Embedded Systems"
This exact reason is why I think that paper is great and also how exceptions should have been implemented in C++ in the first place.