Error Handling : setjmp & longjmp

Points To Catch As for the control flow: setjmp returns twice, and longjmp never returns. When you call setjmp for the first time, to store the environment, it returns zero, And then when you call longjmp, the control flow passes to return from setjmp with the value provided in the argument. Use cases are generally cited as “error handling”, and “don’t use these functions”. Note: setjmp needn’t actually be functions; it may well be a macro....

September 10, 2016 · 2 min · 263 words · Vishal Chovatiya