[an error occurred while processing this directive]

HP OpenVMS Systems

ask the wizard
Content starts here

DEC C setjmp/longjmp status values?

» close window

The Question is:

 
	I wrote a C program which uses the
functions setjmp and longjmp.  If the second
argument of longjmp is 0 then the setjmp
function returned 1.  This is the desired result.
 
 
	Now I rewritten the same program using
the functions decc$setjmp and decc$fast_longjmp.
Now the decc$setjmp function returned 0 when the
second argument of decc$fast_lastjmp is 0.
 
	My question is, why this behaviour?
 
Also I found in the setjmp.h file that a call to
longjmp is redefined to call decc$fast_longjmp
if ALPHA is defined.  If that is the case, how
my first program which used longjmp worked?
 
	Thanks in advance.
 
 


The Answer is :

 
  The second parameter to longjmp and decc$fast_longjmp is the return status
  for the setjmp call.
 
  Per X/Open specifications, if the value passed in to longjmp via the
  parameter is 0, it is converted to 1.  However, the decc$fast_longjmp call
  does not alter the parameter before returning it.
 

answer written or last revised on ( 31-AUG-1998 )

» close window