How does Non - local Jumps in C defined in setjmp.h work?
问题 The C Reference Manual , Appendix B describes two functions setjmp and longjmp for something called non-local jumps . Apart from the basic understanding that setjmp saves the state information and longjmp restores the state , I haven't been able to understand the exact flow and use cases for this feature. So, what exactly does this feature accomplish and where is it useful? 回答1: As for the control flow: setjmp returns twice, and longjmp never returns. When you call setjmp for the first time,