Hi all,
First of all, let me asure you you will not be doing my homework for me if
you are good enough to reply - I have been a professional programmer for a
couple of years now, I just never studied Computer Science so I like to try
and 'catch up' on stuff like this at the weekend.
Having said that I have a couple of questions around the excution stack, in
particular 2 things are bothing me:
1. It is said that on encountering an exception, the execution engine
"unwinds" the call stack looking for a suitable exception handler. In the
example below can we assume that the address of the error handling code is
pushed onto the stack as the return address before executing the try block
and that, infact, the code within the try block is in itself executed as a
function call within it's own stack frame? This can't be the answer though
as the catch block only executes where the stack is unwinding 'in error' not
simply in unwinding during normal flow. So what is really going on??
try
{
//some work
}
catch
{
//handling code
}
2. Continuations in C# - are they really unwinding and rewinding the stack -
or is there some sort of complirer magic going on that creates an invisible
state machine?
Love to know your thoughts on the above.
Cheers