Skip to content

Commit 864eac1

Browse files
author
Colin Robertson
committed
Draft of changes for Ox name
1 parent f460497 commit 864eac1

File tree

6 files changed

+271
-354
lines changed

6 files changed

+271
-354
lines changed

docs/build/reference/TOC.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@
9090
##### [-Og (Global Optimizations)](og-global-optimizations.md)
9191
##### [-Oi (Generate Intrinsic Functions)](oi-generate-intrinsic-functions.md)
9292
##### [-Os, -Ot (Favor Small Code, Favor Fast Code)](os-ot-favor-small-code-favor-fast-code.md)
93-
##### [-Ox (Full Optimization)](ox-full-optimization.md)
93+
##### [-Ox (Enable Most Speed Optimizations)](ox-full-optimization.md)
9494
##### [-Oy (Frame-Pointer Omission)](oy-frame-pointer-omission.md)
9595
#### [-openmp (Enable OpenMP 2.0 Support)](openmp-enable-openmp-2-0-support.md)
9696
#### [-P (Preprocess to a File)](p-preprocess-to-a-file.md)
Lines changed: 45 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "-O1, -O2 (Minimize Size, Maximize Speed) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "09/22/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology:
@@ -29,82 +29,50 @@ caps.latest.revision: 16
2929
author: "corob-msft"
3030
ms.author: "corob"
3131
manager: "ghogen"
32-
translation.priority.ht:
33-
- "cs-cz"
34-
- "de-de"
35-
- "es-es"
36-
- "fr-fr"
37-
- "it-it"
38-
- "ja-jp"
39-
- "ko-kr"
40-
- "pl-pl"
41-
- "pt-br"
42-
- "ru-ru"
43-
- "tr-tr"
44-
- "zh-cn"
45-
- "zh-tw"
4632
---
4733
# /O1, /O2 (Minimize Size, Maximize Speed)
48-
Selects a predefined set of options that affect the size and speed of files.
49-
50-
## Syntax
51-
52-
```
53-
/O1
54-
/O2
55-
```
56-
57-
## Remarks
58-
The following table describes **/O1** and **/O2**.
59-
60-
|Option|Equivalent to|Comment|
34+
35+
Selects a predefined set of options that affect the size and speed of generated code.
36+
37+
## Syntax
38+
39+
> /O1
40+
> /O2
41+
42+
## Remarks
43+
44+
The following table describes **/O1** and **/O2**.
45+
46+
|Option|Equivalent to|Comment|
6147
|------------|-------------------|-------------|
62-
|**/O1** (Minimize Size)|**/Og /Os /Oy /Ob2 /Gs /GF /Gy**|Creates the smallest code in the majority of cases.|
63-
|**/O2** (Maximize Speed)|**/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy**|Creates the fastest code in the majority of cases. (default setting for release builds)|
64-
65-
**/O1** and **/O2** also enable the Named Return Value optimization, which eliminates the copy constructor and destructor of a stack based return value. Consider the following sample. The `Test` function will not create the copy constructor or destructor. Add output statements to the constructor, destructor and copy constructor to see the effect of Named Return Value Optimization when you run the program. For more information, see [Named Return Value Optimization in Visual C++ 2005](http://go.microsoft.com/fwlink/?linkid=131571).
66-
67-
```
68-
// O1_O2_NRVO.cpp
69-
// compile with: /O1
70-
struct A {
71-
A() {}
72-
~A() {}
73-
A(const A& aa) {}
74-
};
75-
76-
A Test() {
77-
A a;
78-
return a;
79-
}
80-
int main() {
81-
A aa;
82-
aa = Test();
83-
}
84-
```
85-
86-
**x86 Specific**
87-
88-
These options imply the use of the Frame-Pointer Omission ([/Oy](../../build/reference/oy-frame-pointer-omission.md)) option.
89-
90-
**END x86 Specific**
91-
92-
### To set this compiler option in the Visual Studio development environment
93-
94-
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
95-
96-
2. Click the **C/C++** folder.
97-
98-
3. Click the **Optimization** property page.
99-
100-
4. Modify the **Optimization** property.
101-
102-
### To set this compiler option programmatically
103-
104-
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.Optimization%2A>.
105-
106-
## See Also
107-
[/O Options (Optimize Code)](../../build/reference/o-options-optimize-code.md)
108-
[Compiler Options](../../build/reference/compiler-options.md)
109-
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
110-
[/EH (Exception Handling Model)](../../build/reference/eh-exception-handling-model.md)
48+
|**/O1** (Minimize Size)|**/Og /Os /Oy /Ob2 /Gs /GF /Gy**|Creates the smallest code in the majority of cases.|
49+
|**/O2** (Maximize Speed)|**/Og /Oi /Ot /Oy /Ob2 /Gs /GF /Gy**|Creates the fastest code in the majority of cases. (default setting for release builds)|
50+
51+
**/O1** and **/O2** are mutually exclusive.
52+
53+
> [!NOTE] **x86 Specific**
54+
> These options imply the use of the Frame-Pointer Omission ([/Oy](../../build/reference/oy-frame-pointer-omission.md)) option.
55+
56+
### To set this compiler option in the Visual Studio development environment
57+
58+
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
59+
60+
1. Click the **C/C++** folder.
61+
62+
1. Click the **Optimization** property page.
63+
64+
1. Modify the **Optimization** property.
65+
66+
### To set this compiler option programmatically
67+
68+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.Optimization%2A>.
69+
70+
## See Also
71+
72+
[/O Options (Optimize Code)](../../build/reference/o-options-optimize-code.md)
73+
74+
[Compiler Options](../../build/reference/compiler-options.md)
75+
76+
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
77+
78+
[/EH (Exception Handling Model)](../../build/reference/eh-exception-handling-model.md)
Lines changed: 50 additions & 60 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "-Ob (Inline Function Expansion) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "09/22/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology:
@@ -37,65 +37,55 @@ caps.latest.revision: 13
3737
author: "corob-msft"
3838
ms.author: "corob"
3939
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"
5440
---
5541
# /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+
8370
> [!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+
89+
[Compiler Options](../../build/reference/compiler-options.md)
90+
91+
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)

0 commit comments

Comments
 (0)