+ 1
setjump - C Libs
Other than tutorials point and geeks for geeks websites does anyone have an example of using setjump and longjump, both site advocate the functions like a try-throw for C.
3 Respostas
+ 2
I cannot find my favorite example that I once saw on Sololearn, but here is a great one that is easy to understand.
https://code.sololearn.com/ccg4HyQEWjLa/?ref=app
0
Brian Thank you for that example. I do not see how that would be used like a try throw more like a conditional jmp in asm. Thank you for the assist. Always great help here.
0
Yes, longjmp resembles a conditional jmp, but it effectively also cleans the stack, allowing you to bypass having to return all the way up the stack, and not requiring also every caller to recognize and deal with the exception before returning.
There is a niche for its use, but I wince at the prospect of actually using it.