In Google C++ Style Guide they state that they are not using exceptions in C++ code at Google. They have reasons for it (“historical” mostly, as usual), but I do not necessarily agree with their view on it. Anyway, exceptions are quite a controversial topic in C++ community, and a must-read C++ Exceptions: Pros and Cons article at CodeProject goes deeper into the subject.
Personally I think that exceptions are really great, although I see how people can get things messy/wrong when using exceptions in inappropriate contexts and/or in inappropriate ways. Recipe to avoid problems? My own short list:
- Use exceptions when they are really needed, i.e. when something exceptional happened
- Understand Exception guarantees AKA Abrahams guarantees (see more at Exception-Safety in Generic Components – Lessons Learned from Specifying Exception-Safety for the C++ Standard Library by David Abrahams)
- Follow Resource Acquisition Is Initialization AKA Resource Initialization Is Acquisition (or RAII/RIIA in short) principle
