volatile (in comp.lang.c)

John R. Levine johnl at ima.ISC.COM
Thu May 12 02:13:47 AEST 1988


In article <1030 at micomvax.UUCP> ray at micomvax.UUCP (Ray Dunn) writes:
>As I said in an earlier posting (on reflection not very succinctly), a
>compiler for a particular [micro-processor] CPU can make *no* assumptions
>about the architecture that the compiled code is running on, other than [the
>architecture of the microprocessor itself].
> ...
>So it's not reasonable to make these controls [e.g. "volatile"] a compiler
>specific thing.
>
>They *have* to be part of the language.

It seems to me that we have a confusion here between making constructs part of
the language and making them part of the standard.  Nobody has ever said that
ANSI C compilers shouldn't have extensions -- they all will, of some sort
or another.  But whether "volatile" belongs in the standard is entirely another
thing.  The standard defines a language for writing portable programs, i.e.
any standard-conforming program should do the same thing on all ANSI C
processors.  I have never seen any suggestion that a program containing
"volatile" would be portable except perhaps to other processors which happen
to have similar memory, I/O, and hardware architectures.

So, sure, go ahead and put it in your compiler where it will be useful for
all sorts of stuff.  But keep it out of the standard until you can define it
in a way that will produce the same results on all C processors.
-- 
John R. Levine, IECC, PO Box 349, Cambridge MA 02238-0349, +1 617 492 3869
{ ihnp4 | decvax | cbosgd | harvard | yale }!ima!johnl, Levine at YALE.something
Rome fell, Babylon fell, Scarsdale will have its turn.  -G. B. Shaw



More information about the Comp.lang.c mailing list