oadl::longjmp
- executes a non-local jump
oadl::longjmp(
buf,
val)
The setjmp()
/ longjmp()
duo can perform a non-local jump. The argument buf must be a
List
of exactly
oadl::JMP_SIZE
elements, which will be
overwritten. The val passed to longjmp()
will be returned by the setjmp()
call that
established the jump target.
Does not return to the location it was called from
TypeCheck
will be thrown if buf is not
a List
containing exactly
oadl::JMP_SIZE
elements
proc foo(buf) { oadl::longjmp(buf, true); "This statement is not reached.\n"; } proc bar() { var buf = new List(oadl::JMP_SIZE); if (oadl::setjmp(buf)) { "Successfully jumped!\n"; } else { foo(buf); } } bar() Successfully jumped!