volatile
. ,
DoSomeOtherStuff() x, x
, volatile . volatile, ,
x - IOP ,
. ,
, , :
int
MeasureExecutionTime()
{
x = 0;
DoSomeOtherStuff();
return x;
}
, DoSomeOtherStuff;
,
DoSomeOtherStuff , x.
, , ,
IO, , ,
.
, , .
volatile.
EDIT:
: ,
volatile ,
x. ,
volatile, g++, Sun CC , ,
V++.
x ,
,
.
,
membar.
, ( -
, ),
, ,
. , volatile
.
volatile,
. ,
.. , (C)
( ).
volatile ,
IO, ,
.
,
.
,
. - :
globalPointer = new Xxx;
globalPointer,
Xxx
globalPointer
. globalPointer
volatile, Xxx,
- Xxx
Xxx.
; ,
volatile. ,
volatile,
membar . (FWIW:
membar ,
10 .)
,
( ) ,
atomic_load atomic_store, ++ 11.
;
. atomic_load to
,
( ,
atomic_read, , atomic_write ,
""
atomic_read ,
"" ,
).