Path: utzoo!utgpu!water!watmath!clyde!rutgers!tut.cis.ohio-state.edu!ukma!uflorida!codas!ateng!chip From: chip@ateng.UUCP (Chip Salzenberg) Newsgroups: comp.lang.c Subject: Re: volatile Message-ID: <212@ateng.UUCP> Date: 31 Mar 88 19:33:59 GMT References: <12578@brl-adm.ARPA> <1988Mar25.172355.348@utzoo.uucp> <588@imagine.PAWL.RPI.EDU> <1988Mar29.004454.2867@utzoo.uucp> Reply-To: chip@ateng.UUCP (Chip Salzenberg) Organization: A T Engineering, Tampa, FL Lines: 30 In article <1988Mar29.004454.2867@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes: >Nobody is saying that the concept is not necessary in certain specialized >situations. >[...] the sort of code we're talking about isn't portable anyway. What about signal handlers? /* begin example */ volatile int hit = 0; int foo(); main() { signal(SIGINT, foo); while (!hit) ; exit(0); } foo() { ++hit; } /* end example */ Without volatile, you can't protect this program from being over-optimized. >"Noalias must go. This is non-negotiable." --DMR Definitely. -- Chip Salzenberg "chip@ateng.UU.NET" or "codas!ateng!chip" A T Engineering My employer's opinions are a trade secret. "Anything that works is better than anything that doesn't."