Path: utzoo!mnetor!uunet!seismo!sundc!pitstop!sun!decwrl!labrea!agate!pasteur!ames!umd5!purdue!i.cc.purdue.edu!j.cc.purdue.edu!pur-ee!uiucdcs!uxc.cso.uiuc.edu!urbsdc!aglew From: aglew@urbsdc.Urbana.Gould.COM Newsgroups: comp.lang.c Subject: Re: Re: volatile: is NOT a frill, i Message-ID: <28700028@urbsdc> Date: 14 Apr 88 15:33:00 GMT References: <3950002@hplvly.HP.COM> Lines: 25 Nf-ID: #R:hplvly.HP.COM:3950002:urbsdc:28700028:000:880 Nf-From: urbsdc.Urbana.Gould.COM!aglew Apr 14 09:33:00 1988 >> extern volatile int user_interrupt; >> while (!user_interrupt) >> sleep(1); >> >> Carrick Talmadge clt@newton.physics.purdue.edu > >Please do not misunderstand me, I would like to see "volatile" >added -- but why would it be required above? If "user_interrupt" >is an external variable, then the compiler is not free to assume >that it will not change across a function call. Since you call >sleep() in the loop, the compiler is not free to use the cached value >of user_interrupt from the previous iteration. > >Greg LImes [limes@sun.com] I have some hope of seeing decent cross-procedural and global analysis in production C compilers in my lifetime ;-}. In which case, the compiler may be able to prove that user_interrupt is not modified by any function called... So, what do you want: "synchronous volatile" and "asynchronous volatile"? aglew@gould.com