Path: utzoo!utgpu!watmath!clyde!att!osu-cis!tut.cis.ohio-state.edu!mailrus!ames!oliveb!pyramid!prls!philabs!micomvax!ray From: ray@micomvax.UUCP (Ray Dunn) Newsgroups: comp.lang.c Subject: Re: const, volatile, etc Message-ID: <1561@micomvax.UUCP> Date: 16 Dec 88 23:07:51 GMT References: <674@quintus.UUCP> <117@halcdc.UUCP> <468@auspex.UUCP> <1526@micomvax.UUCP> <10988@ulysses.homer.nj.att.com> Reply-To: ray@micomvax.UUCP (Ray Dunn) Organization: Philips Electronics Ltd. (TDS - Montreal) St. Laurent QC, Canada Lines: 35 In article <10988@ulysses.homer.nj.att.com> cjc@ulysses.homer.nj.att.com (Chris Calabrese[mav]) writes: >In article <1526@micomvax.UUCP>, ray@micomvax.UUCP (Ray Dunn) writes: >> Nowhere is there any guarantee that each and every variable reference made >> in a 'C' source will translate to a memory reference in the run code. >> >> That is what "volatile" gives you...... > >#define FlameOn 1 >This is an interesting view of this volatile issue (pun intended). >C (B actually)was first created to write a file system handler >on PDP's. Given this fact, how could the variables _possibly_ >been non-volatile? Indeed, 99.9% of UNIX is written in C, >including _all_ the memory mapped I/O, and signal handling >routines which may be in the kernel...... Your argument just evaporated away (pun intended). Maybe you didn't realize it, but unless your compiler documentation states quite clearly that this is all safe, then you have *no* guarantee that the code you describe *has* been compiled correctly. The solution to this argument is really quite simple, and lies in your hands. Unless this guarantee of non-volatility is clearly stated in one of the bibles (K&R etc), *or* in the implementaion documentation, then you have no justification for relying on it (and if it is specified in the latter, then the argument still holds good for 'C' in general). Sooo....quote chapter and verse..... -- Ray Dunn. | UUCP: ..!philabs!micomvax!ray Philips Electronics Ltd. | TEL : (514) 744-8200 Ext: 2347 600 Dr Frederik Philips Blvd | FAX : (514) 744-6455 St Laurent. Quebec. H4M 2S9 | TLX : 05-824090