J
Johannes Schaub (litb)
C++0x says at [intro.execution]/15
"If a side effect on a scalar object is unsequenced relative to either
another side effect on the same scalar object or a value computation using
the value of the same scalar object, the behavior is undefined."
That does not allow reading any volatile variable:
int volatile a = 0;
// undefined behavior:
// - value computation of a
// - side effect on a
// They seem to be unsequenced!
int b = a;
Can anyone please show how these two are sequenced so we do not have
undefined behavior? 4.1 lvalue-to-rvalue does not contain anything to that
effect it seems.
"If a side effect on a scalar object is unsequenced relative to either
another side effect on the same scalar object or a value computation using
the value of the same scalar object, the behavior is undefined."
That does not allow reading any volatile variable:
int volatile a = 0;
// undefined behavior:
// - value computation of a
// - side effect on a
// They seem to be unsequenced!
int b = a;
Can anyone please show how these two are sequenced so we do not have
undefined behavior? 4.1 lvalue-to-rvalue does not contain anything to that
effect it seems.