[cpp-threads] C++ memory model
Nelson, Clark
clark.nelson at intel.com
Wed Sep 23 00:54:46 BST 2009
> > I'd like to just delete the second senetnce:
> >
> > "Implementations shall not move an atomic operation out of an
> > unbounded loop."
>
> I'd like to cast my vote in favor of the sentence. It does indeed carry
> little formal value, but in practice, it can (easily) settle a
> hypothetical
> debate between a compiler user and a compiler writer about whether such
> an
> optimization is allowed.
Well, maybe; but then the argument will turn to the whether the loop in question is really "unbounded", and since the standard doesn't define "unbounded loop", the argument will continue -- without bounds.
So, for example, is the compiler required to prove that a loop can't ever terminate for it to qualify as unbounded? Is that not the halting problem?
I think it would be helpful to see an example of a program for which this sentence might be considered relevant.
Clark
More information about the cpp-threads
mailing list