Path: utzoo!yunexus!torsqnt!david From: david@torsqnt.UUCP (David Haynes) Newsgroups: comp.lang.c Subject: Behaviour of setjmp/longjmp and registers Message-ID: <25@torsqnt.UUCP> Date: 20 Jan 89 03:30:14 GMT Article-I.D.: torsqnt.25 Organization: Sequent Computers (Canada) Ltd., Toronto, CANADA Lines: 24 What should be the result of running the following program? #include main() { register int j; jmp_buf env; j = 1; if(setjmp(env) == 1) { printf("j = %d\n", j); exit(1); } printf("j = %d\n", j); j += 3; longjmp(env, 1); } Sequent, Ultrix and Vax C give results of j = 1, j = 4. Gcc gives a result of j = 1, j = 1. What does the ANSI standard say about this? -david-