Destructor , C/C++ Programming

How can I handle a destructor that fails? Need help please provide example also.

Posted Date: 2/13/2013 1:17:04 AM | Location : United States





Write a message to a log-_le. But do not throw an exception. The C++ rule is that you must never throw an exception from a destructor that is being called during the "stack unwinding" process of another exception. For example, if someone says throw Poo(), the stack will be unwound so all the stack frames between the throw Poo() and the } catch (Poo e) { will get popped. This is called stack unwinding. During stack unwinding, all the local objects in all those stack frames are destructed. If one of those destructors throws an exception (say it throws a Bar object), the C++ runtime system is in a no-win situation: should it ignore the Bar and end up in the} catch (Poo e) { where it was originally headed? Should it ignore the Poo and look for a} catch (Bare) {handler? There is no good answer:either choice loses information. So the C++ language guarantees that it will call terminate() at this point, and terminate() kills the process. Bang you''re dead.

Posted by Archie | Posted Date: 2/13/2013 1:18:53 AM


Related Discussions:- Destructor , Assignment Help, Ask Question on Destructor , Get Answer, Expert's Help, Destructor Discussions

Write discussion on Destructor
Your posts are moderated
Related Questions
Program is to append the contents of one file to another: void main()    {   clrscr();   fstream file1,file2;   char st1[13],st2[13];/* 13 because a filename canno

Project Description: I want someone to create and install a keylogger on a chrome browser. This could be a relatively simple job, please have experience with this type of work.

replace character into string and return value of string that are replaced

Problem: (a) Describe a linked list. (b) Explain the three different types of linked list with the help of diagrams. (c) Give two advantages and two disadvantages o

Project Overview A certain financial institution (bank) wishes to promote its new business products/services by conducting road shows in rural areas. Their aim is to encourage peop

Write out pseudocode for a function called "and" that takes two arguments, both booleans, and returns the logical and of the inputs. DO NOT use the logical and operator: instead, w

Please give me a programming code of first & follow with c or c++ laqnguage .When anyone give me the programming code of first & follow please explain every lines with the help

Static Class Members As we already know all the objects of the class have dissimilar data members but invoke the similar member functions. Though, there is an exception to this


Write a program to find the area under the curve y = f(x) between x = a and x = b, integrate y = f(x) between the limits of a and b. The area under a curve between two points can b