Share via


MSC_OPTIMIZATION

Use the MSC_OPTIMIZATION macro to override the default optimization that the Build utility uses on the compiler.

When you build in a free build environment of the Windows Driver Kit (WDK), the Setenv.bat file clears the _MSC_OPTIMIZATION value. This causes the Build utility to default to the optimization settings of /Oxs. If you want to turn off optimization in order to step through your code, you can set the MSC_OPTIMIZATION value to whatever is appropriate for your compiler.

When you build in a checked build environment of the WDK, the Setenv.bat file sets the MSC_OPTIMIZATION value is set to /Od /Oi. This disables all optimization. All these flags also have platform-specific variants. At the other extreme, you can set the MSC_OPTIMIZATION to /Oxs. This fully optimizes the binaries.

By default, the compiler optimizes for size. You can optimize for speed by adding /Ot to the MSC_OPTIMIZATION value.

You can override the generic MSC_OPTIMIZATION macro with one of the following platform-specific macros:

When the Build utility runs, it first checks for the platform-specific optimization macro. If this is not defined, it checks for MSC_OPTIMIZATION. If MSC_OPTIMIZATION is not defined either, it defaults to /Oxs.

For more information about the compiler optimization options, refer to Compiler Options in the Microsoft SDK documentation.

 

 

Send comments about this topic to Microsoft

Build date: 5/3/2011