| title | -O Options (Optimize Code) | Microsoft Docs | |||
|---|---|---|---|---|
| ms.custom | ||||
| ms.date | 09/25/2017 | |||
| ms.reviewer | ||||
| ms.suite | ||||
| ms.technology |
|
|||
| ms.tgt_pltfrm | ||||
| ms.topic | article | |||
| f1_keywords |
|
|||
| dev_langs |
|
|||
| helpviewer_keywords |
|
|||
| ms.assetid | 77997af9-5555-4b3d-aa57-6615b27d4d5d | |||
| caps.latest.revision | 11 | |||
| author | corob-msft | |||
| ms.author | corob | |||
| manager | ghogen |
The /O options control various optimizations that help you create code for maximum speed or minimum size.
-
/O1 sets a combination of optimizations that generate minimum size code.
-
/O2 sets a combination of optimizations that optimizes code for maximum speed.
-
/Ob controls inline function expansion.
-
/Od disables optimization, to speed compilation and simplify debugging.
-
/Og enables global optimizations.
-
/Oi generates intrinsic functions for appropriate function calls.
-
/Os tells the compiler to favor optimizations for size over optimizations for speed.
-
/Ot (a default setting) tells the compiler to favor optimizations for speed over optimizations for size.
-
/Ox is a combination option that selects several of the optimizations with an emphasis on speed. It is a strict subset of the /O2 optimizations.
-
/Oy suppresses the creation of frame pointers on the call stack for quicker function calls.
You can combine multiple /O options into a single option statement. For example, /Odi is the same as /Od /Oi. Certain options are mutually exclusive and cause a compiler error if used together. See the individual /O options for more information.