|
1 | 1 | ---
|
2 | 2 | title: "-Ob (Inline Function Expansion) | Microsoft Docs"
|
3 | 3 | ms.custom: ""
|
4 |
| -ms.date: "11/04/2016" |
| 4 | +ms.date: "09/25/2017" |
5 | 5 | ms.reviewer: ""
|
6 | 6 | ms.suite: ""
|
7 | 7 | ms.technology:
|
@@ -37,65 +37,53 @@ caps.latest.revision: 13
|
37 | 37 | author: "corob-msft"
|
38 | 38 | ms.author: "corob"
|
39 | 39 | manager: "ghogen"
|
40 |
| -translation.priority.ht: |
41 |
| - - "cs-cz" |
42 |
| - - "de-de" |
43 |
| - - "es-es" |
44 |
| - - "fr-fr" |
45 |
| - - "it-it" |
46 |
| - - "ja-jp" |
47 |
| - - "ko-kr" |
48 |
| - - "pl-pl" |
49 |
| - - "pt-br" |
50 |
| - - "ru-ru" |
51 |
| - - "tr-tr" |
52 |
| - - "zh-cn" |
53 |
| - - "zh-tw" |
54 | 40 | ---
|
55 | 41 | # /Ob (Inline Function Expansion)
|
56 |
| -Controls inline expansion of functions. |
57 |
| - |
58 |
| -## Syntax |
59 |
| - |
60 |
| -``` |
61 |
| -/Ob{0|1|2} |
62 |
| -``` |
63 |
| - |
64 |
| -## Arguments |
65 |
| - **0** |
66 |
| - Disables inline expansions. By default, expansion occurs at the compiler's discretion on all functions, often referred to as *auto-inlining*. |
67 |
| - |
68 |
| - **1** |
69 |
| - Allows expansion only of functions marked [inline](../../cpp/inline-functions-cpp.md), `__inline`, or `__forceinline`, or in a C++ member function defined in a class declaration. |
70 |
| - |
71 |
| - **2** |
72 |
| - The default value. Allows expansion of functions marked as `inline`, `__inline`, or `__forceinline`, and any other function that the compiler chooses. |
73 |
| - |
74 |
| - **/Ob2** is in effect when [/O1, /O2 (Minimize Size, Maximize Speed)](../../build/reference/o1-o2-minimize-size-maximize-speed.md) or [/Ox (Full Optimization)](../../build/reference/ox-full-optimization.md) is used. |
75 |
| - |
76 |
| - This option requires that you enable optimizations using **/O1**, **/O2**, **/Ox**, or **/Og**. |
77 |
| - |
78 |
| -## Remarks |
79 |
| - The compiler treats the inline expansion options and keywords as suggestions. There is no guarantee that any function will be expanded inline. You can disable inline expansions, but you cannot force the compiler to inline a particular function, even when using the `__forceinline` keyword. |
80 |
| - |
81 |
| - You can use the `#pragma`[auto_inline](../../preprocessor/auto-inline.md) directive to exclude functions from consideration as candidates for inline expansion. Also see the `#pragma`[intrinsic](../../preprocessor/intrinsic.md) directive. |
82 |
| - |
| 42 | + |
| 43 | +Controls inline expansion of functions. |
| 44 | + |
| 45 | +## Syntax |
| 46 | + |
| 47 | +> /Ob{0|1|2} |
| 48 | +
|
| 49 | +## Arguments |
| 50 | + |
| 51 | +**0** |
| 52 | +Disables inline expansions. By default, expansion occurs at the compiler's discretion on all functions, often referred to as *auto-inlining*. |
| 53 | + |
| 54 | +**1** |
| 55 | +Allows expansion only of functions marked [inline](../../cpp/inline-functions-cpp.md), `__inline`, or `__forceinline`, or in a C++ member function defined in a class declaration. |
| 56 | + |
| 57 | +**2** |
| 58 | +The default value. Allows expansion of functions marked as `inline`, `__inline`, or `__forceinline`, and any other function that the compiler chooses. |
| 59 | + |
| 60 | +**/Ob2** is in effect when [/O1, /O2 (Minimize Size, Maximize Speed)](../../build/reference/o1-o2-minimize-size-maximize-speed.md) or [/Ox (Enable Most Speed Optimizations)](../../build/reference/ox-full-optimization.md) is used. |
| 61 | + |
| 62 | +This option requires that you enable optimizations using **/O1**, **/O2**, **/Ox**, or **/Og**. |
| 63 | + |
| 64 | +## Remarks |
| 65 | + |
| 66 | +The compiler treats the inline expansion options and keywords as suggestions. There is no guarantee that any function will be expanded inline. You can disable inline expansions, but you cannot force the compiler to inline a particular function, even when using the `__forceinline` keyword. |
| 67 | + |
| 68 | +You can use the `#pragma` [auto_inline](../../preprocessor/auto-inline.md) directive to exclude functions from consideration as candidates for inline expansion. Also see the `#pragma` [intrinsic](../../preprocessor/intrinsic.md) directive. |
| 69 | + |
83 | 70 | > [!NOTE]
|
84 |
| -> Information that is gathered from profiling test runs overrides optimizations that would otherwise be in effect if you specify **/Ob**, **/Os**, or **/Ot**. For more information, see [Profile-Guided Optimizations](../../build/reference/profile-guided-optimizations.md). |
85 |
| - |
86 |
| -### To set this compiler option in the Visual Studio development environment |
87 |
| - |
88 |
| -1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md). |
89 |
| - |
90 |
| -2. Expand **Configuration Properties**, **C/C++**, and select **Optimization**. |
91 |
| - |
92 |
| -3. Modify the **Inline Function Expansion** property. |
93 |
| - |
94 |
| -### To set this compiler option programmatically |
95 |
| - |
96 |
| -- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.InlineFunctionExpansion%2A>. |
97 |
| - |
98 |
| -## See Also |
99 |
| - [/O Options (Optimize Code)](../../build/reference/o-options-optimize-code.md) |
100 |
| - [Compiler Options](../../build/reference/compiler-options.md) |
101 |
| - [Setting Compiler Options](../../build/reference/setting-compiler-options.md) |
| 71 | +> Information that is gathered from profiling test runs overrides optimizations that would otherwise be in effect if you specify **/Ob**, **/Os**, or **/Ot**. For more information, see [Profile-Guided Optimizations](../../build/reference/profile-guided-optimizations.md). |
| 72 | +
|
| 73 | +### To set this compiler option in the Visual Studio development environment |
| 74 | + |
| 75 | +1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md). |
| 76 | + |
| 77 | +1. Expand **Configuration Properties**, **C/C++**, and select **Optimization**. |
| 78 | + |
| 79 | +1. Modify the **Inline Function Expansion** property. |
| 80 | + |
| 81 | +### To set this compiler option programmatically |
| 82 | + |
| 83 | +- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.InlineFunctionExpansion%2A>. |
| 84 | + |
| 85 | +## See Also |
| 86 | + |
| 87 | +[/O Options (Optimize Code)](../../build/reference/o-options-optimize-code.md) |
| 88 | +[Compiler Options](../../build/reference/compiler-options.md) |
| 89 | +[Setting Compiler Options](../../build/reference/setting-compiler-options.md) |
0 commit comments