compiler optimizations

Is there a way to enforce a compiler (g++ 4.7) to not perform any optimizations within a certain block of code?
asm{<assemly code here>}

Compiler will not change your assemly code.
Put that code in a separate cpp file, and compile it without optimization then link back everything together
Maybe:
#pragma GCC optimize ("O0")
Topic archived. No new replies allowed.