Xref: utzoo comp.std.c:1088 comp.sys.encore:220 Path: utzoo!attcan!uunet!cs.utexas.edu!rutgers!apple!bloom-beacon!mit-eddie!bbn!bbn.com!fkittred From: fkittred@bbn.com (Fletcher Kittredge) Newsgroups: comp.std.c,comp.sys.encore Subject: Re: setjmp/longjmp Keywords: setjmp, longjmp Message-ID: <39197@bbn.COM> Date: 27 Apr 89 18:04:03 GMT References: <1447@cunixc.cc.columbia.edu> <12491@ut-emx.UUCP> Sender: news@bbn.COM Reply-To: fkittred@BBN.COM (Fletcher Kittredge) Organization: Bolt Beranek and Newman Inc., Cambridge MA Lines: 26 In article <12491@ut-emx.UUCP> clyde@ut-emx.UUCP (Clyde W. Hoover) writes: > > Well, we ran headlong into that very problem ourselves. What is > going on is that the Encore C compiler puts variables into registers > (making the 'register' declaration somewhat superflous). This is common behavior for any optimizing compiler. For instance, the compilers for the RISC chips for Sun, HP and MIPS do this. Compilers can do a better job than humans in figuring out which variables should be in registers. > Upon longjmp, > the contents of the registers are restored to what they were at the time > of the call to setjmp and since your flag has been stuffed into a register, > it is being reset. Again, this is standard behavior umong modern CPUs and Unix implementations. I have found this behavior in DEC, HP and Sun systems. Both document this behavior, and it appears to me that ANSI C and Posix both require this behavior. regards, fletcher Fletcher E. Kittredge fkittred@bbn.com