[Autogenerated] Structured exception handling or SSH H,
is the official internal mechanism used by Windows
to handle potential exceptions.
In order for this mechanism.
To be easy, to use it, is exposed as four see key words,
that extend the C language in a platform agnostic way.
So we don't have to know assembly language or be
specific about the current processor.
We can instead use these four keywords, to attempt, to handle exceptions.
So here's a brief, summary of those keywords,
the first one is underscore underscore try,
and By the way,
all these extension keywords start with double underscore and That's because
the CSS standard mandates any new keywords created by some compiler vendor to
start with double underscore to prevent or at least.
To minimize the chance of colliding with existing functions or other symbols.
And So, a tribe, blog drops, a piece of code that may or may not.
Raise exceptions.
If an exception, is raised,
then an accept block can follow the Trib blocks that exception.
If indeed this is handled then the code will continue
running normally after the accept block.
If not, if the accept blog doesn't accept.
So, to speak with an a In this case, the exception.
Then the call stack will be looked at starting with the current function.
To find perhaps another triacet block in in the call stack that is able,
and willing, to handle the exception.
Another option which is not really about exceptions.
Per see necessarily is call termination handlers,
and this is provided by the combination of try.
Finally, key words, the idea here.
Is that I would like some piece of code to run no matter what.
However,
I'm getting out of that tri blocks I would like the code to run even if
there is an exception even if there isn't an exception,
doesn't matter.
I would like that code to run no matter what if there is an exception,
then that code can run and then an exception handler will be
search up the call stack As before the idea here,
is that we can make sure, that resources are freed or released in a way,
that would not cause any issue.
Even if there is an exception.
That perhaps prevents the tribe bloc, to run, to completion.
The final keyword provided by SSH is called leaf
and This is just an optimization.
That jumps directly into the final block because you
can't really go around the final block.
Even if you use the return statement or go to Even with the tri
blocks still be code leave is just an optimization.
That generates more optimized,
code by the compiler without having to do something too
complex in order to simply move directly.
To the fi block, that should be there.
So leave only has meaning when code within a tri.
Now the way you can net these things is using tryin or try accept.
You cannot use try accept finally directly on the same level,
but you can net these things at any level.
So it's perfectly fine.
To use try finally within the five block, that has an access block as well.
So it doesn't really provide any kind of limitation here.
Its uh you can do these things uh as deeply nested as makes sense.
And things will run from the inside out.
Let's see some examples of using S C H.