/Ox (Full Optimization)
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)

Combines optimizing options to produce code that favors execution speed over smaller code size.


/Ox can be combined with /Os (/Oxs) to favor smaller code size (optimize for size).

In general, /O2 should be preferred over /Ox and /O1 over /Oxs.

Using /Ox is the same as using the following options:

/Ox is mutually exclusive from:

/Ox also enables the Named Return Value optimization, which eliminates the copy constructor and destructor of a stack based return value. See /O1, /O2 (Minimize Size, Maximize Speed) for more information.

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

© 2016 Microsoft