volatile semantics
Andrew Haley
aph@redhat.com
Sat Jul 16 17:33:00 GMT 2005
D. Hugh Redelmeier writes:
> ================ start of Henry Spencer's comment
>
> There is little room for compiler writers to maneuver here, unless they
> have announced their intentions in advance in their documentation.
> Reading C99 carefully:
>
> ...
>
> 6.3.2.1: when an object is said to have a particular type, the type is
> specified by the lvalue used to designate the object. So the lvalue
> having a volatile-qualified type *means* that the object it designates has
> a volatile-qualified type; "has type X" and "is designated by an lvalue of
> type X" are synonymous (!).
In other words, we're asked to agree that the type of an object
changes depending on how it is accessed.
For the benefit of readers, only the first sentence of this para is
the language of the standard; the rest isn't.
That an object referred to through a volatile pointer must
"temporarily" be treated as though it were declared volatile is the
crux of this argument. I don't believe that such a conclusion must
necessarily be drawn from this language. That may well be what the
authors meant, but I don't think that it's certainly so.
Andrew.
More information about the Gcc
mailing list