Everything

setjmp


Set destination of non-local jump

[Classification]

Standard library

[Syntax]

#include <setjmp.h>

int setjmp(jmp_buf env);

[Return value]

Calling setjmp returns 0. When longjmp is used for a non-local jump, the return value is in the second parameter, val. However, 1 is returned if val is 0.

[Description]

This function sets env as the destination for a non-local jump. In addition, the environment in which setjmp was run is saved to env.

 

[Definition of jmp_buf type in setjmp.h]

typedef int     jmp_buf[14];

[Caution]

When this function is called, only data in the registers reserved by the compiler are saved and restored.

If setjmp is called from within a function in the 22-register mode or common-register mode, data in r20 to r24 are destroyed from within a function in the 32-register mode, and longjmp is then called, the values of r20 to r24 will not be recoverable. In such cases, the values of r20 to r24 must be restored before longjmp is called if they are required.

When -Xep=fix is specified, ep/fix/libsetjmp.lib must be used.