|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
/Ox (Full Optimization)
Updated: April 2009
The /Ox compiler option produces code that favors execution speed over smaller size.
Specifying the /Ox compiler option is the same as using the following options:
/Ob (Inline Function Expansion), where the option parameter is 2 (/Ob2)
/Ox is mutually exclusive from:
The /Ox compiler option also enables the Named Return Value optimization, which eliminates the copy constructor and destructor of a stack based return value. For more information, see /O1, /O2 (Minimize Size, Maximize Speed).
You can cancel out the /Ox compiler option if you specify /Oxs, which combines the /Ox compiler option with /Os (Favor Small Code). The combined options favor smaller code size.
To set this compiler option in the Visual Studio development environment
Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.
Click the C/C++ folder.
Click the Optimization property page.
Modify the Optimization property.
To set this compiler option programmatically