delorie.com/djgpp/doc/libc/libc_703.html
|
search
|
libc.a reference
setjmp
Syntax
| #include <setjmp.h>
int setjmp(jmp_buf j);
|
Description
This function stores the complete CPU state into j. This
information is complete enough that longjmp
(see section longjmp) can
return the program to that state. It is also complete enough to
implement coroutines.
Return Value
This function will return zero if it is returning from its own call.
If longjmp is used to restore the state, it will return whatever value
was passed to longjmp, except if zero is passed to longjmp it will
return one.
Portability
ANSI/ISO C |
C89; C99
|
POSIX |
1003.2-1992; 1003.1-2001
|
Example
| jmp_buf j;
if (setjmp(j))
return;
do_something();
longjmp(j, 1);
|