longjmp

Is a macro that restores a saved environment.

Library:LibC
Classification:ANSI
Service:General C Services

Syntax

  #include <setjmp.h> 
   
  void longjmp (
     jmp_buf   env,   
     int       value); 
  

Parameters

env

(IN) Specifies the environment variable to be restored.

value

(IN) Specifies the value to return.

Remarks

The longjmp macro restores the environment saved by the most recent call to setjmp with the corresponding jmp_buf argument. After longjmp restores the environment, program execution continues as if the corresponding call to setjmp has just returned the value specified by value.

The setjmp macro must be called before longjmp. The routine that called setjmp and set up env must still be active and cannot have returned before longjmp is called. If this happens, the results are unpredictable. If value is passed as 0, the value 1 is substituted on the actual return.

For sample code, see ThrJmp.c.

See Also

setjmp