[pups] V7 setjmp/longjmp

Wolfgang Helbig helbig at Informatik.BA-Stuttgart.DE
Sun Mar 23 22:32:03 AEST 2003

>X-Unix-From: michael_davidson at pacbell.net  Tue Dec 31 17:04:50 2002
>Date: Tue, 31 Dec 2002 08:02:37 -0800
>From: Michael Davidson <michael_davidson at pacbell.net>
>User-Agent: Mozilla/5.0 (Windows; U; Win 9x 4.90; en-US; rv:0.9.4) 
Gecko/20011128 Netscape6/6.2.1
>X-Accept-Language: en-us
>MIME-Version: 1.0
>To: Wolfgang Helbig <helbig at Informatik.BA-Stuttgart.DE>
>CC: pups at minnie.tuhs.org
>Subject: Re: [pups] V7 setjmp/longjmp
>Content-Transfer-Encoding: 7bit
>Wolfgang Helbig wrote:

>>You can trust register variables when setjmp() returns the second time. Then
>>the registers are restored to the values they had when the "next" function was 
>>called, that is the "values as of the time longjmp() was called" (quoted from
>>longjmp(3)'s man page. Thus any variable behaves the same, regardless of its
>>storage class.
>Yes, you are right - V7 restores the register variables to a state which
>is consistent with the other auto variables in the function - ie the value
>which they had when longjmp was called.
>The caveats about not relying on register variables applied to V6.

Nope, even in V6, register variables are restored to the values they had
when reset(III) was called! (reset() is the name of longjmp() in V6).
By the way, reset() is much smaller than longjmp() but provides the same

I wonder why longjmp() was rewritten.


More information about the TUHS mailing list