setexit()

dan%bbncd at sri-unix.UUCP dan%bbncd at sri-unix.UUCP
Fri Oct 21 07:32:39 AEST 1983


From:  Dan Franklin <dan at bbncd>

setexit() and reset() were the crude V6 primitives that were later generalized
to setjmp and longjmp.  They take no arguments, and can be simulated with

    #include <setjmp.h>
    jmp_buf label;
    
    #define setexit()  setjmp(label)
    #define reset() longjmp(label, 0)

at the beginning of any program using them.  In other words, setexit() was like
setjmp of a built-in fixed "jmp_buf"; reset() was like a longjmp to that
"jmp_buf".  Unlike setjmp(), however, you could not find out from the return
value of setexit() whether you were setting it up or returning from a reset()
(in standard V6, that is; we changed ours to return nonzero on reset(), and
probably other people did the same thing).

	Dan Franklin (dan at bbn-unix)



More information about the Comp.unix.wizards mailing list