3 ms·
The google style guide says “ On their face, the benefits of using exceptions outweigh the costs, especially in new projects. However, for existing code...” and
by gumby 7y ago
The google style guide says “ On their face, the benefits of using exceptions outweigh the costs, especially in new projects. However, for existing code...” and they use a lot of existing code.
- pansa2 7y ago> they use a lot of existing code. Doesn’t everyone? Lots of C++ code is not exception safe, including large libraries such as Qt. If I’m writing code that uses such a library, would it be better to take Google’s approach and avoid using exceptions myself, or try to “wrap” the non-exception-safe library somehow?
- gumby 7y agoThere is no single answer to that — depends on the library and how you use it. But if it’s not exception safe it’s not exception safe. There is no way to tell if a constructor failed without catching an exception.