Skip to content

Commit d3871ee

Browse files
authored
Merge pull request #360 from MicrosoftDocs/master
merging latest commits to live
2 parents 152300f + 135f010 commit d3871ee

File tree

568 files changed

+988
-1063
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

568 files changed

+988
-1063
lines changed

docs/build/reference/TOC.md

+1-1
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)
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "-O Options (Optimize Code) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
4+
ms.date: "09/25/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology:
@@ -22,47 +22,36 @@ caps.latest.revision: 11
2222
author: "corob-msft"
2323
ms.author: "corob"
2424
manager: "ghogen"
25-
translation.priority.ht:
26-
- "cs-cz"
27-
- "de-de"
28-
- "es-es"
29-
- "fr-fr"
30-
- "it-it"
31-
- "ja-jp"
32-
- "ko-kr"
33-
- "pl-pl"
34-
- "pt-br"
35-
- "ru-ru"
36-
- "tr-tr"
37-
- "zh-cn"
38-
- "zh-tw"
3925
---
4026
# /O Options (Optimize Code)
41-
The **/O** options control various optimizations that help you create code for maximum speed or minimum size.
42-
43-
- [/O1](../../build/reference/o1-o2-minimize-size-maximize-speed.md) optimizes code for minimum size.
44-
45-
- [/O2](../../build/reference/o1-o2-minimize-size-maximize-speed.md) optimizes code for maximum speed.
46-
47-
- [/Ob](../../build/reference/ob-inline-function-expansion.md) controls inline function expansion.
48-
49-
- [/Od](../../build/reference/od-disable-debug.md) disables optimization, speeding compilation and simplifying debugging.
50-
51-
- [/Og](../../build/reference/og-global-optimizations.md) enables global optimizations.
52-
53-
- [/Oi](../../build/reference/oi-generate-intrinsic-functions.md) generates intrinsic functions for appropriate function calls.
54-
55-
- [/Os](../../build/reference/os-ot-favor-small-code-favor-fast-code.md) tells the compiler to favor optimizations for size over optimizations for speed.
56-
57-
- [/Ot](../../build/reference/os-ot-favor-small-code-favor-fast-code.md) (a default setting) tells the compiler to favor optimizations for speed over optimizations for size.
58-
59-
- [/Ox](../../build/reference/ox-full-optimization.md) selects full optimization.
60-
61-
- [/Oy](../../build/reference/oy-frame-pointer-omission.md) suppresses the creation of frame pointers on the call stack for quicker function calls.
62-
63-
## Remarks
64-
You can also combine multiple **/O** options into a single option statement. For example, `/Odi` is the same as `/Od /Oi`.
65-
66-
## See Also
67-
[Compiler Options](../../build/reference/compiler-options.md)
68-
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
27+
28+
The **/O** options control various optimizations that help you create code for maximum speed or minimum size.
29+
30+
- [/O1](../../build/reference/o1-o2-minimize-size-maximize-speed.md) sets a combination of optimizations that generate minimum size code.
31+
32+
- [/O2](../../build/reference/o1-o2-minimize-size-maximize-speed.md) sets a combination of optimizations that optimizes code for maximum speed.
33+
34+
- [/Ob](../../build/reference/ob-inline-function-expansion.md) controls inline function expansion.
35+
36+
- [/Od](../../build/reference/od-disable-debug.md) disables optimization, to speed compilation and simplify debugging.
37+
38+
- [/Og](../../build/reference/og-global-optimizations.md) enables global optimizations.
39+
40+
- [/Oi](../../build/reference/oi-generate-intrinsic-functions.md) generates intrinsic functions for appropriate function calls.
41+
42+
- [/Os](../../build/reference/os-ot-favor-small-code-favor-fast-code.md) tells the compiler to favor optimizations for size over optimizations for speed.
43+
44+
- [/Ot](../../build/reference/os-ot-favor-small-code-favor-fast-code.md) (a default setting) tells the compiler to favor optimizations for speed over optimizations for size.
45+
46+
- [/Ox](../../build/reference/ox-full-optimization.md) is a combination option that selects several of the optimizations with an emphasis on speed. It is a strict subset of the **/O2** optimizations.
47+
48+
- [/Oy](../../build/reference/oy-frame-pointer-omission.md) suppresses the creation of frame pointers on the call stack for quicker function calls.
49+
50+
## Remarks
51+
52+
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. See the individual **/O** options for more information.
53+
54+
## See Also
55+
56+
[Compiler Options](../../build/reference/compiler-options.md)
57+
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
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/25/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology:
@@ -29,82 +29,46 @@ 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|
61-
|------------|-------------------|-------------|
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)
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 **/O1** and **/O2** compiler options are a quick way to set several specific optimization options at once. The **/O1** option sets the individual optimization options that create the smallest code in the majority of cases. The **/O2** option sets the options that create the fastest code in the majority of cases. The **/O2** option is the default for release builds. This table shows the specific options that are set by **/O1** and **/O2**:
45+
46+
|Option|Equivalent to|
47+
|------------|-------------------|
48+
|**/O1** (Minimize Size)|[/Og](../../build/reference/og-global-optimizations.md) [/Os](../../build/reference/os-ot-favor-small-code-favor-fast-code.md) [/Oy](../../build/reference/oy-frame-pointer-omission.md) [/Ob2](../../build/reference/ob-inline-function-expansion.md) [/Gs](../../build/reference/gs-control-stack-checking-calls.md) [/GF](../../build/reference/gf-eliminate-duplicate-strings.md) [/Gy](../../build/reference/gy-enable-function-level-linking.md)|
49+
|**/O2** (Maximize Speed)|[/Og](../../build/reference/og-global-optimizations.md) [/Oi](../../build/reference/oi-generate-intrinsic-functions.md) [/Ot](../../build/reference/os-ot-favor-small-code-favor-fast-code.md) [/Oy](../../build/reference/oy-frame-pointer-omission.md) [/Ob2](../../build/reference/ob-inline-function-expansion.md) [/Gs](../../build/reference/gs-control-stack-checking-calls.md) [/GF](../../build/reference/gf-eliminate-duplicate-strings.md) [/Gy](../../build/reference/gy-enable-function-level-linking.md)|
50+
51+
**/O1** and **/O2** are mutually exclusive.
52+
53+
> [!NOTE]
54+
> **x86 Specific**
55+
> These options imply the use of the Frame-Pointer Omission ([/Oy](../../build/reference/oy-frame-pointer-omission.md)) option.
56+
57+
### To set this compiler option in the Visual Studio development environment
58+
59+
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
60+
61+
1. Under **Configuration Properties**, open **C/C++** and then choose the **Optimization** property page.
62+
63+
1. Modify the **Optimization** property.
64+
65+
### To set this compiler option programmatically
66+
67+
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.Optimization%2A>.
68+
69+
## See Also
70+
71+
[/O Options (Optimize Code)](../../build/reference/o-options-optimize-code.md)
72+
[Compiler Options](../../build/reference/compiler-options.md)
73+
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)
74+
[/EH (Exception Handling Model)](../../build/reference/eh-exception-handling-model.md)
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/25/2017"
55
ms.reviewer: ""
66
ms.suite: ""
77
ms.technology:
@@ -37,65 +37,53 @@ 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+
[Compiler Options](../../build/reference/compiler-options.md)
89+
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)

0 commit comments

Comments
 (0)