D
DanielJohnson
I have a little confusion with this kind of situation.
Suppose there are two functions, Function First allocates a memory and
then call Function Second..... But in Function Second Exception
occurs!!! How can we notify Function First about this in order to
deallocate the memory allocated by First ?
I found something from Stroutup's web page, saying that it can't be
done ?
http://www.research.att.com/~bs/bs_faq2.html#resume
I was thinking that if we can catch this exception in the second
function then either 1) rethrow so that the first function can catch
it then deallocate appropriately 2) Catch and return an error value
OR
The second is that a function doesn't have to catch it at all. The
exception would automatically be rethrow to the first function.
Can C++ gurus throw some insight into such situations ?
Suppose there are two functions, Function First allocates a memory and
then call Function Second..... But in Function Second Exception
occurs!!! How can we notify Function First about this in order to
deallocate the memory allocated by First ?
I found something from Stroutup's web page, saying that it can't be
done ?
http://www.research.att.com/~bs/bs_faq2.html#resume
I was thinking that if we can catch this exception in the second
function then either 1) rethrow so that the first function can catch
it then deallocate appropriately 2) Catch and return an error value
OR
The second is that a function doesn't have to catch it at all. The
exception would automatically be rethrow to the first function.
Can C++ gurus throw some insight into such situations ?