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

C++ Multiplayer Game Programming Project Project Description: We are seeking an experienced C++ Game Programmer to enhance clientside related aspects of MCS: Mars City Securi

Program is to find the area of room: Program is to find the area of room with default values using classes & object class room   {   private:     int len;     i

enter height of the shape: 1 3 5 3 1 3 5 7 5 3 5 7 9 7 5 3 5 7 5 3 1 3 5 3 1


implement two stacks in one array A[1...n] in such a way that neither stack overflows unless the total number of elements in both stacks together is n. For this you need to produce

#include int main() { int T; int N; int i; scanf("%d",&T)

Purchasing Code Signing Certificate I want to purchase a Code Signing Certificate in good standing from someone in order to sign my .EXE programs with. Please be aware I do n

Damjibhai and Shamjibhai are two jeweler friends. They decide to play a simple game. The game comprises of removing the jewels for polishing, turn by turn. Once a jewel is removed

Using Figure 10.2 as a model, illustrate the result of each operation in the sequence ENQUEUE.Q; 4/, ENQUEUE.Q; 1/, ENQUEUE.Q; 3/, DEQUEUE.Q/, ENQUEUE.Q; 8/, and DEQUEUE.Q/ on an i