Interpretation of volatile - two questions

Doug Gwyn gwyn at smoke.BRL.MIL
Fri Mar 23 03:51:05 AEST 1990


In article <DAVEG.90Mar21203033 at near.cs.caltech.edu> daveg at near.cs.caltech.edu (Dave Gillespie) writes:
>... a compiler on such a machine could surround a
>volatile object with enough padding to keep it isolated.

There are two problems with this.  The minor one is that it wasn't the
intention of X3J11 (as I understand it) for type qualifiers to affect
representations, which is what an impact on padding would amount to.
The more important one is that examples like the one we were using are
typical of access to device registers, for which spurious padding
would simply mean inability to access some of the register contents.
I've encountered examples of Unibus devices and PDP-11 CPU memory
access combinations where one had to be extraordinarily careful, due
to such things as a WRITE cycle having a different effect from a
READ-MODIFY-WRITE.  There is a limit to how much of this sort of thing
can reasonably be reflected in C language rules, which is one of the
reasons that the meaning of volatile access is implementation defined.



More information about the Comp.std.c mailing list