volatile semantics

Dale Johannesen dalej@apple.com
Wed May 4 17:59:00 GMT 2005


On May 4, 2005, at 5:06 AM, Gabriel Dos Reis wrote:

> Andrew Haley <aph@redhat.com> writes:
>
> | Nathan Sidwell writes:
> |  > Dale Johannesen wrote:
> |  >
> |  > > And we don't have to document the behavior at all; it is not 
> documented
> |  > > now.
> |  > I disagree.  It's not documented explicitly in gcc now, because 
> it is doing
> |  > what the std permits, and so documented there. We should document 
> either
> |  >
> |  > a) that current gcc is not breaking the std, and Mike's example 
> is invalid
> |  > code, if one expects a volatile read.  This would be a FAQ like 
> thing.

Both behaviors are standard-compliant.  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.

> I vote for (a).
>
> [...]
>
> | This is a bad extension to gcc and will cause much trouble, just like
> | the old guarantee to preserve empty loops.

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



More information about the Gcc mailing list