home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.unix.internals
- Path: sparky!uunet!sequent!muncher.sequent.com!washer
- From: washer@sequent.com (Jim "Throw it over the wall" Washer)
- Subject: Re: Question about longjmp ()
- Message-ID: <1993Jan10.145640.3647@sequent.com>
- Sender: usenet@sequent.com (usenet )
- Nntp-Posting-Host: crg8.sequent.com
- Organization: Sequent Computer Systems, Inc.
- References: <C0JpMo.1rGr@austin.ibm.com>
- Date: Sun, 10 Jan 93 14:56:40 GMT
- Lines: 26
-
- In article <C0JpMo.1rGr@austin.ibm.com> subra@bynar.austin.ibm.com (Sivarama Subramanian) writes:
- >Hi folks,
- > I have the following code segment.
- > main ()
- > {
- > int i = 0;
- > jmp_buf buf;
- > setjmp (buf);
- > printf ("%d\n", i);
- > if ( i == 1 )
- > exit;
- > i = 1;
- > longjmp (buf, 1);
- > }
- > My question is, should the value of i change or not.
- >
- >Thank you
- >
- >subra
- >
- Absolutely!. There is no magic with setjmp/longjmp.. It simply sets the pc
- and the stack pointer back to the setjmp call and returns again.. 'Both'
- intances of main share a common stack.
- - jim
-
-
-