[cpp-threads] infinite loops

Lawrence Crowl lawrence.crowl at gmail.com
Thu Aug 17 21:18:39 BST 2006


On 8/17/06, Boehm, Hans <hans.boehm at hp.com> wrote:
> > From: Lawrence Crowl
> >
> > On 8/16/06, Boehm, Hans <hans.boehm at hp.com> wrote:
> > > Clearly the transformation is invalid if either count13 or
> > count17 is
> > > volatile or atomic, or if an opaque function call is involved.  But
> > > lots of compiler loop transformations that we do all the time have
> > > similar restrictions.  (If memory mapped I/O were involved,
> > one of the
> > > above better apply.)
> >
> > So, the two statements
> >
> >     f = 1.0; c = 1.0;
> >
> > have different synchronization effects when
> >
> >     float f; std::complex<float> c;
> No, though the compiler may know less about the synchronization effects
> of the latter.
>
> I think we're misunderstanding each other.  They do have different
> optimization effects if std::complex operations are treated as opaque by
> the compiler.  But that's already the case, and we all knew that.  If
> the compiler knows about std::complex, or performs transformations after
> those operations are inline expanded, it should be able to perform the
> same transformations in both cases.

And my point is that, to the programmers, the behavior is unpredictable.
Programmers cannot generally know what is opaque or what
transformations may apply in any given environment.

How will programmers write reliable multi-threaded code if they cannot
predict, from the standard, what their code will do?

-- 
Lawrence Crowl



More information about the cpp-threads mailing list