2 ms·
It's not unreasonable to think of it as "sideways", though. Because the only other interesting meaning of "sideways" is "into another part of the same function
by JoshTriplett 11y ago
It's not unreasonable to think of it as "sideways", though. Because the only other interesting meaning of "sideways" is "into another part of the same function", and that's covered by a simple goto, without even using setjmp/longjmp.
- kazinator 11y agoIt's covered by the GNU C computed goto, maybe, not the static ISO C goto. longjmp is a computed goto; it goes wherever the jmp_buf's run-time contents indicate. This is not only academic; this use case occurs in exception handling based on setjmp/longjmp, when a "finally" type cleanup block catches an exception, and the throw originates from the same function (the "finally" block's corresponding "try").