[cpp-threads] infinite loops

Doug Lea dl at cs.oswego.edu
Mon Jul 31 00:43:53 BST 2006


Boehm, Hans wrote:
>
> A way out of this dilemma appears to be to state that 
> 
> ("infinite loop restriction") Programs that contain infinite loops
> without "acquire+" operations have undefined behavior.
> 

Would it suffice to instead say something (not sure how)
that amounts to the following, to avoid undefinedness?

A construction of the form
   for (i=0;    ; ++i) something; x = 42;
can be transformed to
   x = 42; for (i=0;    ; ++i) something;
if you can establish some k > 0 such that
   for (i=0; i<k; ++i) something; x = 42;
can be transformed to:
   x = 42; for (i=0; i<k; ++i) something;

-Doug















More information about the cpp-threads mailing list