noalias comments to X3J11

Alan J Rosenthal flaps at dgp.toronto.edu
Tue Apr 5 09:19:20 AEST 1988


beowulf!lunge!jesup at steinmetz.UUCP writes:
>The fact that things that need volatile probably won't be portable
>across all machines that have C compilers is a non-issue.

Hardly.  We're discussing a standard for portable C programs.
Compilers are free to accept non-conforming programs.[1]  Your Amiga C
compiler, IF it does optimizations of the kind that make `volatile'
useful, would provide a volatile keyword for use in system-level
programming whether or not it was required by the ANSI standard.[2]
However, it would be silly for the whole world of compiler writers to
have to recognize the volatile keyword, and take it into account while
doing optimizations, just because on the Amiga there are uses for it in
certain inherently non-portable programs.[3]

ajr
--

[1] Note that if the compiler doesn't allow a variable called
``volatile'' and the standard doesn't make this a reserved word, the
compiler is not conforming.  However, command-line options can control
this.  So can a #pragma.

[2] That's a big if.

[3] This is more of a floodgate than most people realize.  For example,
I can easily see the use, on the Amiga, for a type qualifier that
meant, for example, that in the expression "f(a,a)" the two a's must
have been obtained with the same (atomic) load instruction so that
their values are guaranteed identical.  Otherwise you have to turn off
context-switching, assign `a' to a temporary variable, and turn it on again.

-- 
"Comment, Spock?"
"Very bad poetry, Captain."




More information about the Comp.lang.c mailing list