Jump to content
  • Advertisement
Sign in to follow this  

MSVC++ 2010 optimization option?

This topic is 2540 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

does anyone know of a way to allow full optimizations of code compiled on MVC++ 2010 except for the elimination of code that performs nothing relevant. For example

int main()
int var;


return 0;


; 3 : int var;
; 4 :
; 5 : var++;
; 6 : return 0;

xor eax, eax

; 7 : }

ret 0
_main ENDP

since var++ doesnt get stored in a variable it's operation is omitted when the binary is compiled from MSVC++. What exact option can i change in order to prevent this while leaving other optimizations on!?

Share this post

Link to post
Share on other sites
If you're trying to create a location where you can place a debugger breakpoint, you can insert a nop instruction via inline assembly (__asm nop) or a compiler intrinsic (__nop()). I haven't tried the compiler intrinsic but the optimizer definitely won't try to remove inline assembly.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!