www.delorie.com/djgpp/doc/libc/libc_546.html   search  
libc.a reference

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

longjmp

Syntax

 
#include <setjmp.h>

void longjmp(jmp_buf env, int val);

Description

This function reverts back to a CPU state that was stored in env by setjmp (see section setjmp). The state includes all CPU registers, so any variable in a register when setjmp was called will be preserved, and all else will be indeterminate.

The value passed as val will be the return value of setjmp when it resumes processing there. If val is zero, the return value will be one.

Return Value

This function does not return.

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);


  webmaster   donations   bookstore     delorie software   privacy  
  Copyright 2004   by DJ Delorie     Updated Apr 2004