#include <setjmp.h>
int setjmp (
jmp_buf env); /* current environment */
Description
The setjmp function saves the current state of the CPU in
env. The state may be restored by a subsequent
call to the longjmp function. When used together, the
setjmp and longjmp functions provide you with a way to
execute a non-local goto.
A call to the setjmp function saves the current instruction
address as well as other CPU registers. A subsequent call to the
longjmp function restores the instruction pointer and
registers, and execution resumes at the point just after the
setjmp call.
Local variables and function arguments are restored only if
declared with the volatile attribute.
Return Value
The setjmp function returns a value of 0 when the current
state of the CPU has been copied to env. A
non-zero value indicates that the longjmp function was
executed to return to the setjmp function call. In such a
case, the return value is the value passed to the longjmp
function.
This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.
ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.