Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-09-21 07:33:40


Ben Hutchings wrote:
>
> Note also that the compiler could also hoist the test of the control
> variable out of the loop if it can tell that nothing in that loop
> will modify the control variable. This seems to me to be a more
> likely problem.
>
> It is possible that "volatile" may help you to ensure visibility, but
> the semantics of volatile are implementation-dependent and not well
> specified.

Arguably, volatile is quite rigidly specified. In particular, a compiler is
not allowed to hoist a test of a volatile variable out of a loop because
this alters the observable behavior, by definition.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk