volatile semantics

Nathan Sidwell nathan@codesourcery.com
Wed May 4 19:49:00 GMT 2005


Dale Johannesen wrote:

> Both behaviors are standard-compliant.
I don't think anyone's disagreeing with that.  The point is that the
user *requires* a volatile read, but the std *does not* guarantee it.

 > Treating a reference as volatile when you don't have to just means
 > strictly following the rules of the abstract machine; it can never
 > break anything.

ok then, this can be achieved with the -O0 flag :)  I doubt that's
what is desired though.

> I see a difference between a documented extension, and quietly choosing
> from among standard-compliant behaviors the one which is most convenient 
> for users.

I see your point, but I think it is wrong.  How can the programmer rely
on gcc adhering more strictly to the abstract machine than the std
requires, unless the behaviour is documented?  How can the gcc developers
make sure optimizations are not breaking such a promise, unless it is
documented?

nathan

-- 
Nathan Sidwell    ::   http://www.codesourcery.com   ::     CodeSourcery LLC
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk



More information about the Gcc mailing list