AT&T UNIX™PC Unix System V Users Manual - tenox

AT&T UNIX™PC Unix System V Users Manual - tenox AT&T UNIX™PC Unix System V Users Manual - tenox

01.01.2013 Views

I�

SETJMP (3C) SETJMP ( 3C ) NAME setjmp, longjmp - non-local goto SYNOPSIS #include int setj mp (env) jmp_buf env; void longjmp (env, val) jmp_bur env; int val; DESCRIPTION These functions are useful for dealing with errors and interrupts encountered in a low-level subroutine of a program. Setjmp saves its stack environment in env (whose type, jmp_buf, is defined in the header file), for later use by longjmp . It returns the value 0. Longjmp restores the environment saved by the last call of setjmp with the corresponding env argument. After longjmp is completed program execution continues as if the corresponding call of setjmp (which must not itself have returned in the interim) had just returned the value val . Longjmp cannot cause setjmp to return the value 0. If longjmp is invoked with a second argument of 0, setjmp will return 1 . All accessible data have values as of the time longjmp was called. SEE ALSO signal(2). WARNING If longjmp is called when env was never primed by a call to setjmp , or when the last such call is in a function which has since returned, absolute chaos is guaranteed. - 1 -

SETJMP (3C) SETJMP ( 3C )<br />

NAME<br />

setjmp, longjmp - non-local goto<br />

SYNOPSIS<br />

#include <br />

int setj mp (env)<br />

jmp_buf env;<br />

void longjmp (env, val)<br />

jmp_bur env;<br />

int val;<br />

DESCRIPTION<br />

These functions are useful for dealing with errors and interrupts<br />

encountered in a low-level subroutine of a program.<br />

Setjmp saves its stack environment in env (whose type, jmp_buf,<br />

is defined in the header file), for later use by<br />

longjmp . It returns the value 0.<br />

Longjmp restores the environment saved by the last call of setjmp<br />

with the corresponding env argument. After longjmp is completed<br />

program execution continues as if the corresponding call of setjmp<br />

(which must not itself have returned in the interim) had just<br />

returned the value val . Longjmp cannot cause setjmp to return<br />

the value 0. If longjmp is invoked with a second argument of 0,<br />

setjmp will return 1 . All accessible data have values as of the<br />

time longjmp was called.<br />

SEE ALSO<br />

signal(2).<br />

WARNING<br />

If longjmp is called when env was never primed by a call to<br />

setjmp , or when the last such call is in a function which has since<br />

returned, absolute chaos is guaranteed.<br />

- 1 -

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!