Exception guarantees
From Seo Wiki - Search Engine Optimization and Programming Languages
Jump to navigationJump to search
Exception guarantees, also known as the Abrahams guarantees after David Abrahams who formalized the guidelines[1][2], are a set of contractual guidelines that class library implementors and clients use when reasoning about exception safety in C++ programs.
The rules apply to class implementations (components) in the presence of exceptions; they are as follows:
- The strong guarantee: that the operation has either completed successfully or thrown an exception, leaving the program state exactly as it was before the operation started.
- The basic guarantee: that the invariants of the component are preserved, and no resources are leaked. Often refered to as the weak guarantee, because following an exception the system is left in a safe but unknown state.
- The no-throw guarantee: that the operation will not throw an exception.
Code that doesn't follow at least one of the above rules is called exception unsafe.
References
- ↑ "Exception-Safety in Generic Components". http://www.boost.org/community/exception_safety.html. Retrieved 2008-08-29.
- ↑ Abrahams, D. (2000). "Exception-Safety in Generic Components". LECTURE NOTES IN COMPUTER SCIENCE: 69–79. http://www.springerlink.com/content/55993ftk0urcue02/.
If you like SEOmastering Site, you can support it by - BTC: bc1qppjcl3c2cyjazy6lepmrv3fh6ke9mxs7zpfky0 , TRC20 and more...
→