Redigera

Dela via


/O options (Optimize code)

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 (deprecated) 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. /Ox is a strict subset of the /O2 optimizations.

  • /Oy suppresses the creation of frame pointers on the call stack for quicker function calls.

Remarks

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. For more information, see the individual /O options.

See also

MSVC compiler options
MSVC compiler command-line syntax