Path: utzoo!utgpu!attcan!uunet!lll-winken!ncis.llnl.gov!helios.ee.lbl.gov!pasteur!agate!bionet!csd4.milw.wisc.edu!nic.MR.NET!shamash!tank!mimsy!chris From: chris@mimsy.UUCP (Chris Torek) Newsgroups: comp.lang.c Subject: Re: Behaviour of setjmp/longjmp and registers Message-ID: <15559@mimsy.UUCP> Date: 20 Jan 89 21:11:21 GMT References: <25@torsqnt.UUCP> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 21 In article <25@torsqnt.UUCP> david@torsqnt.UUCP (David Haynes) writes: >What should be the result of running the following program? [example of register variables and longjmp deleted] >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? The ANSI standard says that register variables, like all other automatic variables, must be declared `volatile' for you to be able to assume the output will be `j = 1, j = 4'. Of course, since there is no `volatile' qualifier in most existing C compilers, in practise this means that you must not declare variables as register in order to count on them (so that `#define volatile /*empty*/' will work). (I guess you were not reading when I posted this the last two or three times last month. . . .) -- In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163) Domain: chris@mimsy.umd.edu Path: uunet!mimsy!chris