I know that people always say that do not use longjmp, this is evil, it is dangerous.
But I think this might be useful for exiting deep recursions / nested function calls.
Is one longjmpfaster than many re-checks and returns like if(returnVal != SUCCESS) return returnVal;?
As for security, provided that dynamic memory and other resources are correctly released, the problem should not be the problem, right?
So far, it seems that it is longjmpnot difficult to use , and this even makes my code. I feel like using it a lot.
(IMHO in many cases there is no dynamic memory / resources allocated in deep recursion in the first place. Deep function call seems more common for data analysis / manipulation / verification. Dynamic allocation often occurs at a higher level before calling a function in which displayed setjmp.)
source
share