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
wap to print padovan string in c

The STL details are described in many places online (see the CS377 webpage for some links), and there's a very quick introduction in Section A.14. Here are just a few additional no

A: N delete p is a two-step procedure: it calls the destructor, and then releases the memory. The code developed for delete p is functionally similar to this (supposing p is of typ

write c language program that shows stack overflow..

There are ''''n'''' ants on a ''''n+1'''' length rod. The ants are numbered from 1 to n and are initially placed at positions starting from position 1 till position n. They are mov

Explain about the Integer constants in c language? An integer constant is the integer valued number and it refers to a sequence of digits. A decimal integer constant includes o

Dereferencing the Pointer this Sometimes a member function requires to make a copy of the invoking instance so that it can change the copy without affecting the original instan

A palindrome is a string that reads the same from both the ends. Given a string S convert it to a palindrome by doing character replacement. Your task is to convert S to palindrome

source code for padovan string

Project Description: We are seeking online invoice OCR solution. That will help us to automate accounts payable function. User should be able to use the offered pdf file or s