Share via


Optimization Problem

Overview

Optimizing compilers can sometimes change your code to something you wouldn't expect. If you find that the application works when you build for release without optimizations, but not when you build for release with optimizations, this might be the case.

If you suspect that a particular portion of your code is not being optimized correctly and is causing problems in the compilation or running of your program, you can bracket the offending code with

#pragma optimize("", off)

and

#pragma optimize("", on)

Developers have also been able to trace the bad code being generated when optimizations are on by looking at the actual assembly code generated for a function.