Path: utzoo!attcan!uunet!wuarchive!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!uvaarpa!mcnc!rti!mozart!sasrer From: sasrer@unx.sas.com (Rodney Radford) Newsgroups: comp.lang.c Subject: Re: Ambiguity in definition of setjmp/longjmp makes them much less useful Message-ID: <1990Oct09.143521.24019@unx.sas.com> Date: 9 Oct 90 14:35:21 GMT References: <1597@redsox.bsw.com> Organization: SAS Institute Inc. Lines: 32 In article <1597@redsox.bsw.com> campbell@redsox.bsw.com (Larry Campbell) writes: >My real question is this: Why not define the behavior of setjmp/longjmp so >that the values of ALL local variables are defined, whether or not they've >been allocated to registers? Otherwise, setjmp/longjmp are significantly >less useful. The reason for the ambiguity is because ANSI chose not to make setjmp/longjmp functions known by the C compiler so that it just treats them just like any other functions (ie: does not force local automatics values from registers to storage). ANSI chose not to make any of the functions special case so that an application may redefine the functions (although this is frowned upon in some cases). The setjmp/longjmp functions themselves do not have the required information to force the values from the registers, so we are stuck with this oddity. > >For what it's worth, it seems to me that the description of setjmp/longjmp in >K&R 2 does imply that x should have the value 1; is this an area of >disagreement between K&R and ANSI? I believe (just guessing really) that the original C used 'builtins' for the setjmp/longjmp functions, ie: they special cased them. >-- >Larry Campbell The Boston Software Works, Inc. >campbell@redsox.bsw.com 120 Fulton Street >wjh12!redsox!campbell Boston, MA 02109 -- Rodney Radford DG/UX AViiON developer SAS Institute, Inc. sasrer@unx.sas.com (919) 677-8000 x7703 Box 8000, Cary, NC 27512