Probably exceptions is the most controversial C++ feature. Many teams including google do not use them. Of course the decision to use them or not depends on the context -- for example, in some games it might be ok to crash on out-of-memory, but not in a medical equipment control software. Apart from out-of-memory, some teams may use exceptions for network disruption, file-not-found etc. but others may say this is too common to be called an exception (others may say, but if it is common, so what?)
Often the decision not to use exceptions is based on the potentially misguided argument that it is difficult to write exception-safe code. Some people say the argument is misguided because using the alternative of using error codes will lead to at least as much difficult code. David Abrahams clarifies this point.
In this question, I am curious to know:
- For what cases do you use exceptions?
- What is the context of your application? Why can't you live without exceptions?
- How do you manage to write exception-safe code? What is the level of investment you have to make?
- Is/Was it worth it?