How can one handle a destructor that fails?, C/C++ Programming

Assignment Help:

How can one handle a destructor that fails?


Related Discussions:- How can one handle a destructor that fails?

Virtual constructor, Is it possible to have Virtual Constructor? If yes, ho...

Is it possible to have Virtual Constructor? If yes, how? If not, Why not possible?

Change to palindrome, A palindrome is a string that reads the same from bot...

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

string to palindrome, A palindrome is a string that reads the same from b...

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

Copy constructor and overloaded assignment operator, please provide me the ...

please provide me the assignment help. What is the difference between a copy constructor and an overloaded assignment operator?

Discuss polymorphism in c++, Problem 1. Discuss polymorphism in c++. ...

Problem 1. Discuss polymorphism in c++. Explaining Polymorphism 2. Write a program in c++ to read a 3X2 matrix and find smallest number in that matrix. Writin

Program to create a class and store student information, Develop a Student ...

Develop a Student class that has the following header file: #ifndef STUDENT_H #define STUDENT_H #include #include #include using namespace std; class Stu

Can i drop the [] while deleteing array of some built-in , Can I drop the [...

Can I drop the [] while deleteing array of some built-in type (char, int, etc)? A: No. you can't Sometimes programmers think that the [] in the delete[] p only present so the

C program for function of average, C program for function  of average ...

C program for function  of average int average(int); void main() {           int max=0,c=0;           clrscr();           printf("ENTER THE LIMIT OF INPUT FOR AV

Last ant on rod, There are ''n'' ants on a ''n+1'' length rod. The ants are...

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 moving eith

3/15/2013 5:17:54 AM

How can one handle a destructor that fails?

A: Write down a message to a log-_le. However do not throw an exception. The C++ rule is that you ought to never throw an exception from a destructor which is being called during the "stack unwinding" procedure of another exception. For instance, if someone says throw Foo(), the stack will be unwound so all of the stack frames among the throw Foo() and the } catch (Foo e) { will get popped. It is called stack unwinding. Throughout stack unwinding, the entire 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 condition: should it avoid the Bar and end up in the} catch (Foo e) {where it was headed originally? Should it avoid the Foo and look for a } catch (Bare) { handler? There is no good answer: either choice loses information. Thus the C++ language guarantees that it will call terminate() at this point, and terminate() kills the procedure. Bang you''re dead.

 

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd