What is the setjump call

Kenneth Almquist ka at hou3c.UUCP
Sun Oct 14 08:41:32 AEST 1984


> The "libPW" library on System V Release 2 (and, presumably, all earlier
> versions) calls "longjmp" with only one argument; this works (I presume)
> on System V on the VAX-11 by sheer accident, as there must have been a
> non-zero value on the stack at the point where "longjmp" expected its
> argument.

Actually, the fact that longjmp works with one argument is not an
accident.  The SVR2 manual page for setjmp states, "If longjmp is
invoked with a second argument of 0, setjmp will return 1."  This
was done to make the two argument version of setjmp backward com-
patable with the one argument version.  The BSD version of setjmp
does not do this, so you have to convert all longjmp calls to use
two arguments when porting code to Berkely UN*X.
				Kenneth Almquist



More information about the Comp.lang.c mailing list