/Ob (Inline Function Expansion)
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

/Ob (Inline Function Expansion)


The Inline Function Expansion (/Obn) options control inline expansion of functions, where n is one of the following:

Option Description
/Ob0 Disables inline expansion, which is on by default.
/Ob1 Expands only functions marked as inline or __inline or, in a C++ member function, defined within a class declaration.
/Ob2 Expands functions marked as inline or __inline and any other function that the compiler chooses (expansion occurs at the compiler's discretion, often referred to as auto-inlining).

/Ob2 is in effect when /O1, /O2 or /Ox is used.

This option requires that you enable optimizations using /O1, /O2, /Ox, or /Og.

The compiler treats the inline expansion options and keywords as suggestions. There is no guarantee that functions will be expanded inline. You cannot force the compiler to inline a particular function.

You can also use #pragma auto_inline to exclude functions from being considered as candidates for inline expansion. Also see #pragma intrinsic.

To set this compiler option in the Visual Studio development environment

  1. Open the project's Property Pages dialog box. For details, see Setting Visual C++ Project Properties.
  2. Click the C/C++ folder.
  3. Click the Optimization property page.
  4. Modify the Inline Function Expansion property.

To set this compiler option programmatically

See InlineFunctionExpansion Property.

See Also

/O Options (Optimize Code) | Compiler Options | Setting Compiler Options

© 2015 Microsoft