Path: utzoo!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!agate!bionet!csd4.milw.wisc.edu!mailrus!cornell!rochester!uhura.cc.rochester.edu!ur-valhalla!micropen!dave From: dave@micropen (David F. Carlson) Newsgroups: comp.lang.c Subject: Re: Behaviour of setjmp/longjmp and registers Summary: see bugs Message-ID: <627@micropen> Date: 23 Jan 89 18:59:05 GMT References: <25@torsqnt.UUCP> Organization: Micropen Dirent Writing Systems, Pittsford, NY Lines: 27 In article <25@torsqnt.UUCP>, david@torsqnt.UUCP (David Haynes) writes: > What should be the result of running the following program? > register int j; > jmp_buf env; > > 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? > According to SVr3.0 setjmp(3): BUGS: The values of the registers on the second return from setjmp are the register values at the time of the first call to setjmp, not those at the time longjmp. This doesn't answer the ANSI question per se, but it does point out that using register variables around setjmp/longjmp is a fool's game. Play it safe, use a condom. -- David F. Carlson, Micropen, Inc. micropen!dave@ee.rochester.edu "The faster I go, the behinder I get." --Lewis Carroll