Path: utzoo!attcan!uunet!auspex!guy From: guy@auspex.auspex.com (Guy Harris) Newsgroups: comp.std.c Subject: Re: why does setjmp return 1 after longjmp(buf,0)? Message-ID: <4075@auspex.auspex.com> Date: 17 Sep 90 23:10:59 GMT References: <6511@muffin.cme.nist.gov> <13866@smoke.BRL.MIL> Organization: Auspex Systems, Santa Clara Lines: 20 >I don't recall any, because it not only reflected existing practice, >it also is obviously essential to prevent a longjmp from returning to >the wrong branch of the setjmp return path. Even if the person calling "longjmp" screws up and passes a zero argument? It would seem that the prevent this from happening by the simple expedient of not screwing up.... >Every version of longjmp I can recall ever maintaining worked exactly >that way. The BSD one doesn't do that; however, a quick check of the V7 version and the 32V version (from Berkeley's archives, no less) reveals that they seem to have worked the same way as the S5 one, namely that passing a return value of 0 is equivalent to passing a return value of 1. So it looks as if Berkeley are the ones who went off the path, here. Fortunately, the ANSI C spec forbids that sort of thing, so 4.4BSD (and systems that picked up this divergence and haven't yet removed it) will probably get with the program....