4 ms·
LongJmp can be used as a way to implement exceptions at a low level, especially in languages like C, where you dont have them as a language construct. You call
by TFortunato 7y ago
LongJmp can be used as a way to implement exceptions at a low level, especially in languages like C, where you dont have them as a language construct.
You call SetJmp, where you would want to put your try/catch blocks, then no matter how deep down some call stack you go, if an errir occurs, you can immediately jump back to where you called setjmp and handle it / report the error or whatever, rather than having to handle and bubble up the error by at every intermediate level, "returning" your way up the call stack.