How is exception handling implemented by programming languages?

I wanted to get a deep understanding of how programming languages ​​implement exception handling and how it works inside the hood. I will try to talk about this in many subqueries, as shown below.

  • What is the mechanism used when programming languages ​​to implement try {} catch {} blocks (under the hood)?
  • How exactly does stack unwinding work?
  • What are the main differences between try {} / catch {} implementations between different languages ​​such as C ++ and Java? Do they suggest significantly different or are they the same?
  • Is the setjump / longjump method of rewinding a stack in C similar to the try / throw / catch block?
  • Why do people say stack unwinding is expensive?
  • What is SEH (structured exception handling?)
+6
source share
1 answer

This is a good description of the work of exception handling, https://gforge.inria.fr/frs/download.php/26600/PBE2-Exceptions-2010-03-02.pdf

+2
source

Source: https://habr.com/ru/post/900755/


All Articles