Exceptions are a mechanism for error handling. The STL class for an exceptions is called std::exception.
- Use exceptions for error handling, instead of using return error codes [2,11]
- Throw an exception to indicate that you cannot perform an assigned task [1]
- Use purpose-designed user-defined types as exceptions (not built-in types) [3]
- Always catch exception& and ... [12]
- Don't try to catch every exception in every function [4]
- Release locally owned resources before throwing an exception [5]
- Don't use exceptions where more local control structures will suffice [6]
- Not every program needs to be exception-safe [7]
- Don't use exception specification [8]
- The STL exception hierarchy can be (but does not have to be) used for a user's own exceptions [13]
- Don't assume that every exception is derived from class std::exception [9]
- Have main catch and report every exception [10]
- If you can't use exceptions, consider system_error [14]
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 386: '[2] Throw an exception to indicate that you cannot perform an assigned task'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 386: '[3] Use exceptions for error handling'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 386: '[4] Use purpose-designed user-defined types as exceptions (not built-in types)'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[8] Don't try to catch every exception in every function'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[12] Release locally owned resources before throwing an exception'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[14] Don't use exceptions where more local control structures will suffice'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[17] Not every program needs to be exception-safe'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[24] Don't use exception specification'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[26] Don't assume that every exception is derived from class exception'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 13.7. Advice. page 387: '[27] Have main() catch and report every exception'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 30.5. Advice. page 883: '[9] Prefer exception-based error handling over return-code-based error handling'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 30.5. Advice. page 883: '[10] Always catch exception& (for standard-library and language support exceptions) and ... (for unexpected exceptions)'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 30.5. Advice. page 883: '[11] The standard-library exception hierarchy can be (but does not have to be) used for a user's own exceptions'
- Bjarne Stroustrup. The C++ Programming Language (4th edition). 2013. ISBN: 978-0-321-56384-2. Chapter 30.5. Advice. page 884: '[15] If you can't use exceptions, consider <system_error>'