Skip to content

Commit d84e448

Browse files
authored
Merge pull request MicrosoftDocs#650 from MicrosoftDocs/cr-permissive-effect
Add /Zc:twoPhase-, effect of /permissive- on /Zc switches
2 parents 1df08af + 85f1102 commit d84e448

20 files changed

+864
-705
lines changed

docs/build/reference/TOC.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
##### [/Zc:threadSafeInit (Thread-safe Local Static Initialization)](zc-threadsafeinit-thread-safe-local-static-initialization.md)
148148
##### [/Zc:throwingNew (Assume operator new throws)](zc-throwingnew-assume-operator-new-throws.md)
149149
##### [/Zc:trigraphs (Trigraphs Substitution)](zc-trigraphs-trigraphs-substitution.md)
150+
##### [/Zc:twoPhase- (disable two-phase name lookup)](zc-twophase.md)
150151
##### [/Zc:wchar_t (wchar_t Is Native Type)](zc-wchar-t-wchar-t-is-native-type.md)
151152
#### [/Zf (Faster PDB generation)](zf.md)
152153
#### [/Zg (Generate Function Prototypes)](zg-generate-function-prototypes.md)

docs/build/reference/permissive-standards-conformance.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,11 @@ Specify standards conformance mode to the compiler. Use this option to help you
2323
2424
## Remarks
2525

26-
You can use the **/permissive-** compiler option to specify standards-conforming compiler behavior. This option disables permissive behaviors, and sets the [/Zc](../../build/reference/zc-conformance.md) compiler options for strict conformance. In the IDE, this option also makes the IntelliSense engine underline non-conforming code.
26+
You can use the **/permissive-** compiler option to specify standards-conforming compiler behavior. This option disables permissive behaviors, and sets the [/Zc](../../build/reference/zc-conformance.md) compiler options for strict conformance. In the IDE, this option also makes the IntelliSense engine underline non-conforming code.
2727

2828
By default, the **/permissive-** option is set in new projects created by Visual Studio 2017 version 15.5 and later versions. It is not set by default in earlier versions. When the option is set, the compiler generates diagnostic errors or warnings when non-standard language constructs are detected in your code, including some common bugs in pre-C++11 code.
2929

30-
The **/permissive-** option is compatible with almost all of the header files from the latest Windows Kits, such as the Software Development Kit (SDK) or Windows Driver Kit (WDK), starting in the Windows Fall Creators
31-
SDK (10.0.16299.0). Older versions of the SDK may fail to compile under **/permissive-** for various source code conformance reasons. The compiler and SDKs ship on different release timelines, therefore there are some remaining issues. For specific header file issues, see [Windows header issues](#windows-header-issues) below.
30+
The **/permissive-** option is compatible with almost all of the header files from the latest Windows Kits, such as the Software Development Kit (SDK) or Windows Driver Kit (WDK), starting in the Windows Fall Creators SDK (10.0.16299.0). Older versions of the SDK may fail to compile under **/permissive-** for various source code conformance reasons. The compiler and SDKs ship on different release timelines, therefore there are some remaining issues. For specific header file issues, see [Windows header issues](#windows-header-issues) below.
3231

3332
The **/permissive-** option sets the [/Zc:strictStrings](../../build/reference/zc-conformance.md) and [/Zc:rvalueCast](../../build/reference/zc-conformance.md) options to conforming behavior. They default to non-conforming behavior. You can pass specific **/Zc** options after **/permissive-** on the command line to override this behavior.
3433

@@ -403,7 +402,7 @@ In versions before Visual Studio 2017 version 15.5, use this procedure:
403402
404403
1. Open your project's **Property Pages** dialog box.
405404
406-
1. Under **Configuration Properties**, expand the **C/C++** folder and choose the **Command Line** property page.
405+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
407406
408407
1. Enter the **/permissive-** compiler option in the **Additional Options** box. Choose **OK** or **Apply** to save your changes.
409408

docs/build/reference/zc-alignednew.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "/Zc:alignedNew (C++17 over-aligned allocation) | Microsoft Docs"
3-
ms.date: "12/14/2017"
3+
ms.date: "02/28/2018"
44
ms.technology: ["cpp-tools"]
55
ms.topic: "article"
66
f1_keywords: ["/Zc:alignedNew"]
@@ -22,7 +22,7 @@ Enable support for C++17 over-aligned **new**, dynamic memory allocation aligned
2222

2323
Visual Studio version 15.5 enables compiler and library support for C++17 standard over-aligned dynamic memory allocation. When the **/Zc:alignedNew** option is specified, a dynamic allocation such as `new Example;` respects the alignment of *Example* even when it’s greater than `max_align_t`, the largest alignment required for any fundamental type. When the alignment of the allocated type is no more than that guaranteed by the original operator **new**, available as the value of the predefined macro **\_\_STDCPP\_DEFAULT\_NEW\_ALIGNMENT\_\_**, the statement `new Example;` results in a call to `::operator new(size_t)` as it did in C++14. When the alignment is greater than **\_\_STDCPP\_DEFAULT\_NEW\_ALIGNMENT\_\_**, the implementation instead obtains the memory by using `::operator new(size_t, align_val_t)`. Similarly, deletion of over-aligned types invokes `::operator delete(void*, align_val_t)` or the sized delete signature `::operator delete(void*, size_t, align_val_t)`.
2424

25-
The **/Zc:alignedNew** option is only available when [/std:c++17](std-specify-language-standard-version.md) or [/std:c++latest](std-specify-language-standard-version.md) is enabled. Under **/std:c++17** or **/std:c++latest**, **/Zc:alignedNew** is enabled by default to conform to the ISO C++17 standard. If the only reason you implement operator **new** and **delete** is to support over-aligned allocations, you may no longer need this code in C++17 mode. To turn this option off and revert to the C++14 behavior of **new** and **delete** when **/std::c++17** or **/std:c++latest** is specified, specify **/Zc:alignedNew-**. If you implement operator **new** and **delete** but you are not ready to implement the over-aligned operator **new** and **delete** overloads that have the `align_val_t` parameter, use the **/Zc:alignedNew-** option to prevent the compiler and Standard Library from generating calls to the over-aligned overloads.
25+
The **/Zc:alignedNew** option is only available when [/std:c++17](std-specify-language-standard-version.md) or [/std:c++latest](std-specify-language-standard-version.md) is enabled. Under **/std:c++17** or **/std:c++latest**, **/Zc:alignedNew** is enabled by default to conform to the ISO C++17 standard. If the only reason you implement operator **new** and **delete** is to support over-aligned allocations, you may no longer need this code in C++17 mode. To turn this option off and revert to the C++14 behavior of **new** and **delete** when **/std::c++17** or **/std:c++latest** is specified, specify **/Zc:alignedNew-**. If you implement operator **new** and **delete** but you are not ready to implement the over-aligned operator **new** and **delete** overloads that have the `align_val_t` parameter, use the **/Zc:alignedNew-** option to prevent the compiler and Standard Library from generating calls to the over-aligned overloads. The [/permissive-](permissive-standards-conformance.md) option does not change the default setting of **/Zc:alignedNew**.
2626

2727
## Example
2828

@@ -95,7 +95,7 @@ For information about conformance issues in Visual C++, see [Nonstandard Behavio
9595

9696
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
9797

98-
1. Select the **Command Line** property page in the **C/C++** folder.
98+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
9999

100100
1. Modify the **Additional Options** property to include **/Zc:alignedNew** or **/Zc:alignedNew-** and then choose **OK**.
101101

Lines changed: 26 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,41 @@
11
---
22
title: "-Zc:auto (Deduce Variable Type) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "11/04/2016"
5-
ms.reviewer: ""
6-
ms.suite: ""
4+
ms.date: "02/28/2018"
75
ms.technology: ["cpp-tools"]
8-
ms.tgt_pltfrm: ""
96
ms.topic: "article"
107
f1_keywords: ["/Zc:auto"]
118
dev_langs: ["C++"]
129
helpviewer_keywords: ["-Zc compiler options (C++)", "Deduce variable type (C++)", "/Zc compiler options (C++)", "Zc compiler options (C++)"]
1310
ms.assetid: 5f5bc102-44c3-4688-bbe1-080594dcee5c
14-
caps.latest.revision: 9
1511
author: "corob-msft"
1612
ms.author: "corob"
1713
manager: "ghogen"
1814
ms.workload: ["cplusplus"]
1915
---
2016
# /Zc:auto (Deduce Variable Type)
21-
The **/Zc:auto[-]** compiler option tells the compiler how to use the [auto keyword](../../cpp/auto-keyword.md) to declare variables. If you specify the default option, **/Zc:auto**, the compiler deduces the type of the declared variable from its initialization expression. If you specify **/Zc:auto-**, the compiler allocates the variable to the automatic storage class.
22-
23-
## Syntax
24-
25-
```
26-
/Zc:auto[-]
27-
```
28-
29-
## Remarks
30-
The C++ standard defines an original and a revised meaning for the `auto` keyword. Before [!INCLUDE[cpp_dev10_long](../../build/includes/cpp_dev10_long_md.md)], the keyword declares a variable in the automatic storage class; that is, a variable that has a local lifetime. Starting with [!INCLUDE[cpp_dev10_long](../../build/includes/cpp_dev10_long_md.md)], the keyword deduces the type of a variable from the declaration's initialization expression. Use the **/Zc:auto[-]** compiler option to tell the compiler to use the original or revised meaning of the `auto` keyword.
31-
32-
The compiler issues an appropriate diagnostic message if your use of the `auto` keyword contradicts the current compiler option. For more information, see [auto Keyword](../../cpp/auto-keyword.md). For more information about conformance issues with Visual C++, see [Nonstandard Behavior](../../cpp/nonstandard-behavior.md).
33-
34-
### To set this compiler option in Visual Studio
35-
36-
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
37-
38-
2. Click the **Configuration Properties** node.
39-
40-
3. Click the **C/C++** node.
41-
42-
4. Click the **Command Line** node.
43-
44-
5. Add **/Zc:auto** or **/Zc:auto-** to the **Additional options:** pane.
45-
46-
## See Also
47-
[/Zc (Conformance)](../../build/reference/zc-conformance.md)
48-
[auto Keyword](../../cpp/auto-keyword.md)
17+
18+
The **/Zc:auto[-]** compiler option tells the compiler how to use the [auto keyword](../../cpp/auto-keyword.md) to declare variables. If you specify the default option, **/Zc:auto**, the compiler deduces the type of the declared variable from its initialization expression. If you specify **/Zc:auto-**, the compiler allocates the variable to the automatic storage class.
19+
20+
## Syntax
21+
22+
> **/Zc:auto**[**-**]
23+
24+
## Remarks
25+
26+
The C++ standard defines an original and a revised meaning for the `auto` keyword. Before [!INCLUDE[cpp_dev10_long](../../build/includes/cpp_dev10_long_md.md)], the keyword declares a variable in the automatic storage class; that is, a variable that has a local lifetime. Starting with [!INCLUDE[cpp_dev10_long](../../build/includes/cpp_dev10_long_md.md)], the keyword deduces the type of a variable from the declaration's initialization expression. Use the **/Zc:auto[-]** compiler option to tell the compiler to use the original or revised meaning of the `auto` keyword. The **/Zc:auto** option is on by default. The [/permissive-](permissive-standards-conformance.md) option does not change the default setting of **/Zc:auto**.
27+
28+
The compiler issues an appropriate diagnostic message if your use of the `auto` keyword contradicts the current **/Zc:auto** compiler option. For more information, see [auto Keyword](../../cpp/auto-keyword.md). For more information about conformance issues with Visual C++, see [Nonstandard Behavior](../../cpp/nonstandard-behavior.md).
29+
30+
### To set this compiler option in Visual Studio
31+
32+
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
33+
34+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
35+
36+
1. Add **/Zc:auto** or **/Zc:auto-** to the **Additional options:** pane.
37+
38+
## See also
39+
40+
[/Zc (Conformance)](../../build/reference/zc-conformance.md)<br/>
41+
[auto Keyword](../../cpp/auto-keyword.md)

docs/build/reference/zc-conformance.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
---
2-
title: "-Zc (Conformance) | Microsoft Docs"
2+
title: "/Zc (Conformance) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "9/29/2017"
5-
ms.reviewer: ""
6-
ms.suite: ""
4+
ms.date: "03/06/2018"
75
ms.technology: ["cpp-tools"]
8-
ms.tgt_pltfrm: ""
96
ms.topic: "article"
107
f1_keywords: ["/zc"]
118
dev_langs: ["C++"]
129
helpviewer_keywords: ["/Zc compiler options [C++]", "-Zc compiler options [C++]", "Conformance compiler options", "Zc compiler options [C++]"]
1310
ms.assetid: db1cc175-6e93-4a2e-9396-c3725d2d8f71
14-
caps.latest.revision: 15
1511
author: "corob-msft"
1612
ms.author: "corob"
1713
manager: "ghogen"
@@ -23,11 +19,11 @@ You can use the **/Zc** compiler options to specify standard or Microsoft-specif
2319

2420
## Syntax
2521

26-
> /Zc:_option_{,_option_}
22+
> **/Zc:**_option_{,_option_}
2723
2824
## Remarks
2925

30-
When Visual Studio has implemented an extension to C or C++ that is not compatible with the standard, you can use a `/Zc` conformance option to specify standard-conforming or Microsoft-specific behavior. For some options, the Microsoft-specific behavior is the default, to prevent large-scale breaking changes to existing code. In other cases, the default is the standard behavior, where improvements in security, performance, or compatibility outweigh the costs of breaking changes. The default setting of each conformance option may change in newer versions of Visual Studio. For more information about each conformance option, see the topic for the specific option.
26+
When Visual Studio has implemented an extension to C or C++ that is not compatible with the standard, you can use a `/Zc` conformance option to specify standard-conforming or Microsoft-specific behavior. For some options, the Microsoft-specific behavior is the default, to prevent large-scale breaking changes to existing code. In other cases, the default is the standard behavior, where improvements in security, performance, or compatibility outweigh the costs of breaking changes. The default setting of each conformance option may change in newer versions of Visual Studio. For more information about each conformance option, see the topic for the specific option. The [/permissive-](permissive-standards-conformance.md) compiler option implicitly sets the conformance options that are not set by default to their conformant setting.
3127

3228
These are the `/Zc` compiler options:
3329

@@ -48,6 +44,7 @@ These are the `/Zc` compiler options:
4844
|[threadSafeInit\[-\]](zc-threadsafeinit-thread-safe-local-static-initialization.md)|Enable thread-safe local static initialization (on by default).|
4945
|[throwingNew\[-\]](zc-throwingnew-assume-operator-new-throws.md)|Assume `operator new` throws on failure (off by default).|
5046
|[trigraphs\[-\]](zc-trigraphs-trigraphs-substitution.md)|Enable trigraphs (obsolete, off by default).|
47+
|[twoPhase-](zc-twophase.md)|Use non-conforming template parsing behavior (conforming by default).|
5148
|[wchar_t\[-\]](zc-wchar-t-wchar-t-is-native-type.md)|`wchar_t` is a native type, not a typedef (on by default).|
5249

5350
For more information about conformance issues in Visual C++, see [Nonstandard Behavior](../../cpp/nonstandard-behavior.md).

docs/build/reference/zc-externconstexpr.md

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,13 @@
11
---
22
title: "/Zc:externConstexpr (Enable extern constexpr variables) | Microsoft Docs"
33
ms.custom: ""
4-
ms.date: "9/29/2017"
5-
ms.reviewer: ""
6-
ms.suite: ""
4+
ms.date: "02/28/2018"
75
ms.technology: ["cpp-tools"]
8-
ms.tgt_pltfrm: ""
96
ms.topic: "article"
107
f1_keywords: ["/Zc:externConstexpr"]
118
dev_langs: ["C++"]
129
helpviewer_keywords: ["-Zc:externConstexpr compiler option (C++)", "extern constexpr variables (C++)"]
1310
ms.assetid: 4da5e33a-2e4d-4ed2-8616-bd8f43265c27
14-
caps.latest.revision: 9
1511
author: "corob-msft"
1612
ms.author: "corob"
1713
manager: "ghogen"
@@ -23,19 +19,19 @@ The **/Zc:externConstexpr** compiler option tells the compiler to conform to the
2319

2420
## Syntax
2521

26-
> /Zc:externConstexpr[-]
22+
> **/Zc:externConstexpr**[**-**]
2723
2824
## Remarks
2925

30-
The **/Zc:externConstexpr** compiler option causes the compiler to apply external linkage to variables declared by using `extern constexpr`. The **/Zc:externConstexpr** option is available starting in Visual Studio 2017 Update 15.5. In earlier versions of Visual Studio, and by default or if **/Zc:externConstexpr-** is specified, Visual Studio applies internal linkage to `constexpr` variables even if the `extern` keyword is used.
26+
The **/Zc:externConstexpr** compiler option causes the compiler to apply external linkage to variables declared by using `extern constexpr`. In earlier versions of Visual Studio, and by default or if **/Zc:externConstexpr-** is specified, Visual Studio applies internal linkage to `constexpr` variables even if the `extern` keyword is used. The **/Zc:externConstexpr** option is available starting in Visual Studio 2017 Update 15.6. and is off by default. The [/permissive-](permissive-standards-conformance.md) option does not enable **/Zc:externConstexpr**.
3127

3228
If a header file contains a variable declared `extern constexpr`, it must be marked [__declspec(selectany)](../../cpp/selectany.md) in order to merge the duplicate declarations into a single instance in the linked binary. Otherwise you may see linker errors, for example, LNK2005, for violations of the one-definition rule.
3329

3430
### To set this compiler option in Visual Studio
3531

3632
1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
3733

38-
1. Under **Configuration Properties**, expand **C/C++** and then choose **Command Line**.
34+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
3935

4036
1. Add **/Zc:externConstexpr** or **/Zc:externConstexpr-** to the **Additional options:** pane.
4137

0 commit comments

Comments
 (0)