volatile (in comp.lang.c)

mcdonald at uxe.cso.uiuc.edu mcdonald at uxe.cso.uiuc.edu
Fri May 13 00:50:00 AEST 1988


>In article <2674 at geac.UUCP> daveb at geac.UUCP (David Collier-Brown) asks:
> [On the necessity of "volatile"]
>>  Specifically:
>>	1) what architectures currently use asynchronously-changing
>>memory locations for program notification of events? DEC Vax,
>>various CDC boxes, MIPS(tm),...

>The asking of this question is a clear example of the distorted view many
>people have, whose environment is restricted to DEC, SUN, CDC, IBM etc
>*standard* machines.  This is not meant as a flame, only as an observation.

>The answer to the question is "as many architectures as there are
>proprietary designs of micro-processor based equipment which use
>asynchronously changing memory locations, including *all*, for example,
>which use memory mapped I/O.

>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].

>Writing a compiler for a 68000 is a different exercise than writing one for
>a VAX, which is a fully defined environment.

Not really. It is perfectly possible to plug any device one wants to
into a Q-bus or Unibus VAX. And ALL VAX devices use memory-mapped IO!
It's true that you can't plug anything you want into a VAXBI VAX (
unless you use a converter): therefore we aren't buying any VAXBI VAXes. 
And Vms allows one to actually use those devices, albeit with a bit of
trouble.


>So it's not reasonable to make these controls [e.g. "volatile"] a compiler
>specific thing.

>They *have* to be part of the language.

Agreed.

Sorry to sound like a broken record, but this is IMPORTANT for us who
do real-time work. It is important to realize that there is no good
reason to REQUIRE that all a given ANSI-C program run the same
on all machines. In fact it is vitally important that there be
NO SUCH REQUIREMENT. The requirement for portability should (indeed
MUST) stop somewhere, and "volatile" looks like the perfect place to 
stop. If it didn't stop at volatile, it most certainly would stop
after a call to an assembler routine, which would be slow. 

Doug McDonald                | VOLATILE must stay! This is non-negotiable.



More information about the Comp.lang.c mailing list