Feature Only in Professional and Enterprise Editions Code optimization is supported only in Visual C++ Professional and Enterprise Editions. For more information, see Visual C++ Editions.
/Ob{0|1|2}
The In-line Function Expansion (/Obn) options control inline expansion of functions, where n is one of the following:
Command line | Project settings | Description |
---|---|---|
/Ob0 | Disable | Disables inline expansion (default) |
/Ob1 | Only __inline | Expands only functions marked as inline or __inline or, in a C++ member function, defined within a class declaration (default with /O1, /O2, and /Ox) |
/Ob2 | Any Suitable | Expands functions marked as inline or __inline and any other function that the compiler chooses (expansion occurs at compiler discretion—often referred to as “auto-inlining”).
This option requires that you enable optimizations using /O1, /O2, /Ox, /Ot, or /Og. |
The compiler treats the inline expansion options and keywords as suggestions. There is no guarantee that functions will be inlined. 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.
/O options (Optimize Code) | Compiler Options | Setting Compiler Options