volatile semantics
Gabriel Dos Reis
gdr@integrable-solutions.net
Sat Jul 23 02:59:00 GMT 2005
Geoff Keating <geoffk@geoffk.org> writes:
| On 22/07/2005, at 4:33 PM, Ian Lance Taylor wrote:
|
| > Geoffrey Keating <geoffk@geoffk.org> writes:
| >
| >> Although I can see that this is how you might think about the
| >> semantics of 'const' and 'volatile', I don't think they're an exact
| >> match for the model in the standard. In fact, I think you could
| >> exchange the words 'const' and 'volatile' in the above and they would
| >> be equally accurate.
| >>
| >
| > Sure, and I think my ultimate point would still be accurate: gcc
| > should handle the access using the qualification of the pointer, not
| > of the underlying object. The rest of the argument is just
| > motivation.
|
| By "equally accurate", I also meant "equally inaccurate".
|
| You've successfully argued that 'const' and 'volatile' are the same
| in lots of ways; but 'const' and 'volatile' do differ. In order to
| be successful in this argument, you need to argue that the
| differences don't matter.
|
| And, unfortunately, the differences *do* matter. The standard does
| not say "any expression referring to a volatile-qualified type must
| be evaluated strictly according to the rules of the abstract
| machine". What it says is that "An object that has volatile
| qualified type may be modified in ways unknown to the implementation"
| and then lists some of the consequences of an object being modifiable
| in that way. So there are no "semantics of the access"; the
| semantics attach to the object.
I disagree with statement. There is a "semantics of access". It is
implementation-defined.
| This is part of what I meant by saying that your model isn't a match
| for the model in the standard. Your model had semantics attached to
| the access.
On the contrary, I find his moel most faithful than the interpretation
you offer. The standard describes things like side effect and such in
terms of *access*.
-- Gaby
More information about the Gcc
mailing list