When implementing lock-free data structures and timing code it\'s often necessary to suppress the compiler\'s optimisations. Normally people do this using asm volatile
Just for completeness on Lily Ballard's answer, Visual Studio 2010 offers _ReadBarrier(), _WriteBarrier() and _ReadWriteBarrier() to do the same (VS2010 doesn't allow inline assembly for 64-bit apps).
These don't generate any instructions but affect the behaviour of the compiler. A nice example is here.
MemoryBarrier() generates lock or DWORD PTR [rsp], 0