Guardian C Library Calls Reference Manual
Reference to Library Calls
Guardian TNS C Library Calls Reference Manual—128833 3-159
setjmp
setjmp
The setjmp macro saves its calling environment in its argument for later use by the 
longjmp function. 
env
is a buffer of type jmp_buf, where setjmp saves its calling environment.
Return Value
is zero from the direct invocation of setjmp. If the return results from a subsequent 
call to longjmp, the return value is determined by the val parameter in the longjmp 
call.
Usage Guidelines
•
You must declare an environment buffer (of type jmp_buf) to pass as the env 
parameter.
•
The type jmp_buf is declared in the header <setjmph>.
Example
The following example declares ebuf and passes its address to the setjmp function:
jmp_buf ebuf; /* Declares a multi-word buffer */
/* ... */
switch (setjmp(ebuf))
{
 case 0 : /* the original setjmp call, simply break */
 break;
 case 1 : /* longjmp call with val == 1 */
/* ... */
 break;
 case 2 : /* longjmp call with val == 2 */
/* ... */
 break;
/* ... */
}
#include <setjmph>
int setjmp(jmp_buf env);










