Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2004-10-01 08:08:21


Ben Hutchings wrote:
> Peter Dimov wrote:
>>
>> A memory access is observable if and only if the variable is
>> volatile. 1.9/6.
>
> Yes, I understand what is observable (extensional definition). Yet
> the real meaning of "observable" (intensional definition) is vague (and
> understandably so).

Oh well. There is a clear definition of "observable" in the standard. But we
know that this is not the real meaning of "observable". Hence, there is no
clear definition of "observable" in the standard. Therefore, a compiler is
allowed to compile all programs to nops.

>>> the fact that
>>> volatile memory accesses are "observable behaviour" doesn't prevent
>>> them from being optimised away under the as-if rule.
>>
>> A compiler is not allowed to alter the observable behavior under the
>> "as if" rule. 1.9/1.
>
> Yet there is no statement of *how* the observable behaviour can be
> observed. Observation is outside the program and outside the standard
> and so practically implementation-defined.

There is no statement of how calls to I/O library functions can be observed.
Therefore, the compiler is allowed to not call them. There is no statement
of how 1+2 can be verified to yield 3. Therefore, the compiler is allowed to
substitute 5.


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