18.9 STACK UNWINDING
Earlier, we have seen that after catch clause is completed, control goes to statement after try block. Control never returns to position in try block from where the exception is thrown. It requires special treatment by the system in two regards. The first one is related to stack.
Imagine a situation that no exception has occurred. In that case all functions called (even recursively) would have normally returned. It implies that stack would have been in a position where it was just before entering try block. For simplicity let us call it as base level. If exception has occurred, at that time stack may be containing things (variables and return addresses) above the base level. Therefore, it is necessary to unwind the stack, ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access