/Zo (Enhance Optimized Debugging)
Generate enhanced debugging information for optimized code in non-debug builds.
The /Zo compiler switch generates enhanced debugging information for optimized code. Optimization may use registers for local variables, reorder code, vectorize loops, and inline function calls. These optimizations can obscure the relationship between the source code and the compiled object code. The /Zo switch tells the compiler to generate additional debugging information for local variables and inlined functions. Use it to see variables in the Autos, Locals, and Watch windows when you step through optimized code in the Visual Studio debugger. It also enables stack traces to show inlined functions in the WinDBG debugger. Debug builds that have disabled optimizations (/Od) do not need the additional debugging information generated when /Zo is specified. Use the /Zo switch to debug Release configurations with optimization turned on. For more information on optimization switches, see /O Options (Optimize Code). The /Zo option is enabled by default in Visual Studio when you specify debugging information with /Zi or /Z7. Specify /Zo- to explicitly disable this compiler option.
The /Zo switch is available starting in Visual Studio 2013 Update 3, and it replaces the previously undocumented /d2Zi+ switch.
To set the /Zo compiler option in Visual Studio
Open the Property Pages dialog box for the project. For more information, see Working with Project Properties.
Select the Configuration Properties, C/C++ folder.
Select the Command Line property page.
Modify the Additional Options property to include
/Zoand then choose OK.
To set this compiler option programmatically
- See AdditionalOptions.