3 ms·
setjmp isn't a function so it's not comparable. Here's a better analogy. The equivalent just works if we use C++ exception handling instead of setjmp. You can
by kazinator 3y ago
setjmp isn't a function so it's not comparable.
Here's a better analogy. The equivalent just works if we use C++ exception handling instead of setjmp. You can change variables after a try, and those values will be reliably observed in the catch.
setjmp and longjmp are a module that you can write in a small amount of assembly language, without changing anything in the compiler to support them. (Provided it has a bona fide volatile.)
Exception handling is a fairly complex feature requiring supporting in the compiler, with various strategies that have different performance trade-offs.
- gpderetta 3y ago> Here's a better analogy. The equivalent just works if we use C++ exception handling instead of setjmp. You can change variables after a try, and those values will be reliably observed in the catch That's a very nice comparison.