FAQ 26.09 Should resource deallocation primitives signal failure by throwing an exception?

No.

Examples of resource deallocation primitives include overloads of operator delete, closing files, unlocking semaphores, and so on.

Because these are commonly called from destructors, they should signal failure by some means other than throwing an exception. The alternatives range from printing a diagnostic error message in a log file to halting the system, and the best choice depends on the circumstances. This reduces the number of cases in which terminate() is inadvertently called.



C++ FAQs
C Programming FAQs: Frequently Asked Questions
ISBN: 0201845199
EAN: 2147483647
Year: 2005
Pages: 566
Authors: Steve Summit

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net