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
Luminous Jewels - The Polishing Game Byteland county is very famous for luminous jewels. Luminous jewels are used in making beautiful necklaces. A necklace consists of various lum

Implementing Operator Functions The general format of the Operator function is: return_type operator op ( argument list );   Where op is the symbol for the operator be

.Create a Csharp solution that will show a maze in the user interface and will show a mouse walking through the maze attempting to locate the exit door (the cheese).

The zipped folder int_collection.zip (downloaded from Blackboard) contains an abstract class AbstractIntCollection and two interfaces: IntList and IntStack. The abstract class cont

w.a.p to find outWrite 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.


write a program that calculates points along a rhodonea curve.... ? int fillArray( double data[ ], int nValues, double min, double max ); o Used to fill in the theta array. Return

#questionhow can i add new customer and alot him a new unique id ..

c-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   #include float start_point, /

How does free know the size of memory to be deleted.? int *i = (int *)malloc(12); followed by free(i); how did free function call know how much of memory to delete? A: It bas