Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ setjmp(3) — Ultrix-11 3.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

signal(2)

setjmp(3)

NAME

setjmp, longjmp − non-local goto

SYNTAX

#include <setjmp.h>

int setjmp(env)
jmp_buf env;

void longjmp(env, val)
jmp_buf env;
int env;

DESCRIPTION

These subroutines are useful for dealing with errors and interrupts encountered in a low-level subroutine of a program. 

The setjmp subroutine saves its stack environment in env for later use by longjmp.  It returns value 0. 

The longjmp subroutine restores the environment saved by the last call of setjmp.  It then returns in such a way that execution continues as if the call of setjmp had just returned the value val to the function that invoked setjmp, which must not itself have returned in the interim.  All accessible data have values as of the time longjmp was called. 

RESTRICTIONS

If longjmp is called even though env was never primed by a call to setjmp, or when the last such call was in a function which has since returned, absolute chaos is guaranteed. 

SEE ALSO

signal(2)

Typewritten Software • bear@typewritten.org • Edmonds, WA 98026