Abstract

This chapter focuses on exception handling in C++ environment. An exception is a situation that would be unusual for the program that is being processed. Exception handling in C++ propagates the exceptions up the stack. When errors occur, the function generating the error can throw an exception. The simple way to support the strong exception safety guarantee is to ensure that nothing is updated until programmers have executed all the steps that might throw an exception. This means taking copies of sub-objects and making the changes on the copies, prior to swapping the state between the copies and the original sub-objects. There are three rules to exception handling: destructors may not propagate exceptions; the states of two instances of a class may be swapped without an exception being thrown; and an object may own at the most one resource.

Full Text
Paper version not known

Talk to us

Join us for a 30 min session where you can share your feedback and ask us any queries you have

Schedule a call

Disclaimer: All third-party content on this website/platform is and will remain the property of their respective owners and is provided on "as is" basis without any warranties, express or implied. Use of third-party content does not indicate any affiliation, sponsorship with or endorsement by them. Any references to third-party content is to identify the corresponding services and shall be considered fair use under The CopyrightLaw.