NAME

longjmp - executes a non-local jump

SYNOPSIS

oadl::longjmp(buf, val)

DESCRIPTION

The setjmp() / longjmp() duo can perform a non-local jump. The argument buf must be a JmpBuf allocated via a new JmpBuf() call. The val passed to longjmp() will be returned by the setjmp() call that established the jump target.

RETURN VALUE

Does not return to the location it was called from

ERRORS

TypeCheck will be thrown if buf is not a JmpBuf

EXAMPLE

    proc foo(buf)
    {
        oadl::longjmp(buf, true);
        "This statement is not reached.\n";
    }

    proc bar()
    {
        var buf = new JmpBuf();
        if (oadl::setjmp(buf)) {
            "Successfully jumped!\n";
        }
        else {
            foo(buf);
        }
    }

    bar()
Successfully jumped!

SEE ALSO

setjmp