473,395 Members | 1,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

what is stack unwinding

4
what is use of stack in exception handling.. and what is stack unwinding
Mar 28 '07 #1
3 6729
r035198x
13,262 8TB
what is use of stack in exception handling.. and what is stack unwinding
Which language? Java, .NET?
Mar 28 '07 #2
MMcCarthy
14,534 Expert Mod 8TB
As there has been no reply regarding language this question is being moved to the Miscellaneous Discussions forum.

ADMIN
Mar 29 '07 #3
weaknessforcats
9,208 Expert Mod 8TB
Stack unwinding is the name given to the process of undoing all of the processing in a series of nested calls.

That is:

Funcation A calls Function B calls Function C.

In function C there are 3 stack frames. Should FunctionC throw an exception, the program will go directly to the nearest catch block. That is, FunctionC will not return. Hence, FunctionB will not return andhence FunctionA will not return. That means the stack frame for FunctionC cannot be cleaned up, nor the stack frame for FuncitonB and the stack frame for FunctionC.

Stack unwinding applies to the cleaning up of FunctionB and FunctionA stack frames so that the program is in the state that FunctionA was never called in the first place. FunctionC must clean itself up before exiting top the catch block.

This applies to C++, Java and C#.
Apr 15 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

14
by: Kevin Grigorenko | last post by:
Hello, I couldn't find an obvious answer to this in the FAQ. My basic question, is: Is there any difference in allocating on the heap versus the stack? If heap or stack implementation is not...
22
by: MSG | last post by:
Hello void f1(int n) { vector<int> x(n); /* C++ */ } void f2(int n) { int x; /* C99 only */ } void f3(int n) { int* x = new int; /* C++ */ delete x; }
5
by: Senthilvel | last post by:
Hi, The automatic variables declared in the try bock will be destroyed when an exception is thrown due to stack unwinding. So i expected the following code to call the destructor of B but it...
2
by: Steven T. Hatton | last post by:
On page 366 of TC++PL(SE) we are told " The destructor will be called independently of whether the function is exited normally or exited because an exception is thrown." On page 382 the...
14
by: Singleton | last post by:
Can some one guide me what is word boundary? google is no good for me for this thanks in advance
6
by: John Ratliff | last post by:
What happens to objects created on the stack when you throw an exception? For example, suppose I opened a file for reading with an fstream. If I perform a read operation and I don't like the...
53
by: jaso | last post by:
Can you give any comments on this code? I used one goto, is it bad? #include <stdio.h> #include <stdlib.h> #include <ctype.h> #include <string.h> #include <assert.h> #define NOT_NULL 1
10
by: ypjofficial | last post by:
Hello All, since the programs' stack is shared among all the function inside the program, I was just doing some R&D to see whether the same stack space is used for the variables inside the...
4
by: Tony | last post by:
Well the subject says it all. Do I have to have it if I use classes in C++? Tony
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.