Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
/Ox (Full Optimization)

/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:

/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.

In general, specify /O2 (Maximize Speed) instead of /Ox, and /O1 (Minimize Size) instead of /Oxs.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see How to: Open Project Property Pages.

  2. Click the C/C++ folder.

  3. Click the Optimization property page.

  4. Modify the Optimization property.

To set this compiler option programmatically




April 2009

Revised style of compiler option links to display only the relevant name.

Customer feedback.

Community Additions

© 2015 Microsoft