Skip to content

Commit b3941b6

Browse files
authored
Merge pull request #4672 from MicrosoftDocs/main
11/09 AM Publish
2 parents e0e2b81 + 3aa60fd commit b3941b6

11 files changed

+107
-33
lines changed

docs/build/reference/compiler-options-listed-alphabetically.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ This table contains an alphabetical list of compiler options. For a list of comp
233233
| [`/Zc:ternary[-]`](zc-ternary.md) | Enforce conditional operator rules on operand types (off by default). |
234234
| [`/Zc:threadSafeInit[-]`](zc-threadsafeinit-thread-safe-local-static-initialization.md) | Enable thread-safe local static initialization (on by default). |
235235
| [`/Zc:throwingNew[-]`](zc-throwingnew-assume-operator-new-throws.md) | Assume **`operator new`** throws on failure (off by default). |
236-
| `/Zc:tlsGuards[-]` | Generate runtime checks for TLS variable initialization (on by default). |
236+
| [`/Zc:tlsGuards[-]`](zc-tlsguards.md) | Generate runtime checks for TLS variable initialization (on by default). |
237237
| [`/Zc:trigraphs`](zc-trigraphs-trigraphs-substitution.md) | Enable trigraphs (obsolete, off by default). |
238238
| [`/Zc:twoPhase[-]`](zc-twophase.md) | Use non-conforming template parsing behavior (conforming by default). |
239239
| [`/Zc:wchar_t[-]`](zc-wchar-t-wchar-t-is-native-type.md) | **`wchar_t`** is a native type, not a typedef (on by default). |
240-
| `/Zc:zeroSizeArrayNew[-]` | Call member `new`/`delete` for 0-size arrays of objects (on by default). |
240+
| [`/Zc:zeroSizeArrayNew[-]`](zc-zerosizearraynew.md) | Call member `new`/`delete` for 0-size arrays of objects (on by default). |
241241
| [`/Ze`](za-ze-disable-language-extensions.md) | Deprecated. Enables C89 language extensions. |
242242
| [`/Zf`](zf.md) | Improves PDB generation time in parallel builds. |
243243
| [`/ZH:[MD5|SHA1|SHA_256]`](zh.md) | Specifies MD5, SHA-1, or SHA-256 for checksums in debug info. |
@@ -246,7 +246,7 @@ This table contains an alphabetical list of compiler options. For a list of comp
246246
| [`/Zl`](zl-omit-default-library-name.md) | Removes the default library name from the *`.obj`* file. |
247247
| [`/Zm`](zm-specify-precompiled-header-memory-allocation-limit.md) | Specifies the precompiled header memory allocation limit. |
248248
| [`/Zo[-]`](zo-enhance-optimized-debugging.md) | Generate richer debugging information for optimized code. |
249-
| [`/Zp[n]`](zp-struct-member-alignment.md) *n* | Packs structure members. |
249+
| [`/Zp[n]`](zp-struct-member-alignment.md) | Packs structure members. |
250250
| [`/Zs`](zs-syntax-check-only.md) | Checks syntax only. |
251251
| [`/ZW`](zw-windows-runtime-compilation.md) | Produces an output file to run on the Windows Runtime. |
252252

docs/build/reference/compiler-options-listed-by-category.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -195,19 +195,19 @@ This article contains a categorical list of compiler options. For an alphabetica
195195
| [`/Zc:ternary[-]`](zc-ternary.md) | Enforce conditional operator rules on operand types (off by default). |
196196
| [`/Zc:threadSafeInit[-]`](zc-threadsafeinit-thread-safe-local-static-initialization.md) | Enable thread-safe local static initialization (on by default). |
197197
| [`/Zc:throwingNew[-]`](zc-throwingnew-assume-operator-new-throws.md) | Assume **`operator new`** throws on failure (off by default). |
198+
| [`/Zc:tlsGuards[-]`](zc-tlsguards.md) | Generate runtime checks for TLS variable initialization (on by default). |
198199
| [`/Zc:trigraphs`](zc-trigraphs-trigraphs-substitution.md) | Enable trigraphs (obsolete, off by default). |
199-
| `/Zc:tlsGuards[-]` | Generate runtime checks for TLS variable initialization (on by default). |
200200
| [`/Zc:twoPhase[-]`](zc-twophase.md) | Use non-conforming template parsing behavior (conforming by default). |
201201
| [`/Zc:wchar_t[-]`](zc-wchar-t-wchar-t-is-native-type.md) | **`wchar_t`** is a native type, not a typedef (on by default). |
202-
| `/Zc:zeroSizeArrayNew[-]` | Call member `new`/`delete` for 0-size arrays of objects (on by default). |
202+
| [`/Zc:zeroSizeArrayNew[-]`](zc-zerosizearraynew.md) | Call member `new`/`delete` for 0-size arrays of objects (on by default). |
203203
| [`/Ze`](za-ze-disable-language-extensions.md) | Deprecated. Enables C89 language extensions. |
204204
| [`/Zf`](zf.md) | Improves PDB generation time in parallel builds. |
205205
| [`/ZH:[MD5|SHA1|SHA_256]`](zh.md) | Specifies MD5, SHA-1, or SHA-256 for checksums in debug info. |
206206
| [`/ZI`](z7-zi-zi-debug-information-format.md) | Includes debug information in a program database compatible with Edit and Continue. (x86 only) |
207207
| [`/Zi`](z7-zi-zi-debug-information-format.md) | Generates complete debugging information. |
208208
| [`/Zl`](zl-omit-default-library-name.md) | Removes the default library name from the *`.obj`* file. |
209209
| [`/Zo[-]`](zo-enhance-optimized-debugging.md) | Generate richer debugging information for optimized code. |
210-
| [`/Zp[n]`](zp-struct-member-alignment.md) *n* | Packs structure members. |
210+
| [`/Zp[n]`](zp-struct-member-alignment.md) | Packs structure members. |
211211
| [`/Zs`](zs-syntax-check-only.md) | Checks syntax only. |
212212
| [`/ZW`](zw-windows-runtime-compilation.md) | Produces an output file to run on the Windows Runtime. |
213213

docs/build/reference/header-unit-json-reference.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
description: "Reference for header-units.json file"
33
title: "C++ header unit.json reference"
4-
ms.date: 02/11/2022
4+
ms.date: 11/09/2022
55
author: "tylermsft"
66
ms.author: "twhitney"
77
f1_keywords: ["header-units.json"]
@@ -45,9 +45,9 @@ The `header-units.json` in this directory can contain `a.h` and `b.h`, but not `
4545
}
4646
```
4747

48-
The reason `macros.h` can't be listed in this `header-units.json` file is that during the scan phase, the header unit (`.ifc`) might not be compiled yet for `macros.h`. In that case, `MACRO` won't be defined when `a.h` is compiled. That means `b.h` will be missing from the list of dependencies for `a.h`. Because it isn't in the list of dependencies, the build system won't build a header unit for `b.h` despite it being listed in the `header-units.json` file.
48+
The reason `macros.h` can't be listed in this `header-units.json` file is that during the scan phase, the header unit (`.ifc`) might not be compiled yet for `macros.h`. In that case, `MACRO` won't be defined when `a.h` is compiled. That means `b.h` will be missing from the list of dependencies for `a.h`. Since it isn't in the list of dependencies, the build system won't build a header unit for `b.h` despite it being listed in the `header-units.json` file.
4949

50-
To avoid this problem when there's a dependency on a macro in another header file, the header file that defines the macro is excluded from the list of files that can be compiled into a header unit. This way the header file that defines the macro is treated as an `#include` and `MACRO` will be visible so that `b.h` is included and listed as one of the dependencies.
50+
To avoid this problem, when there's a dependency on a macro in another header file, the header file that defines the macro is excluded from the list of files that can be compiled into a header unit. This way the header file that defines the macro is treated as a normal `#include` and `MACRO` will be visible so that `b.h` is included and listed as one of the dependencies.
5151

5252
### Preventing duplicated symbols
5353

@@ -69,7 +69,7 @@ import "c.h";
6969

7070
If the compiler built header units for `a.h`, `b.h` and `c.h`, then the compiled header units `a.h.ifc`, `b.h.ifc`, and `c.h.ifc` would each contain all of the types from `b.h`. Compiling `Source.cpp`, which imports both `a.h` and `c.h`, would require the compiler to deduplicate the `b.h` types, which would impact build performance.
7171

72-
But if there's a `header-units.json` in the `b.h` directory, and `/translateInclude` is specified, the following happens:
72+
But if there's a `header-units.json` in the `b.h` directory, and `/translateInclude` is specified, then the following happens:
7373

7474
1. The scan of `a.h` and `c.h` lists `b.h` as a header unit import in the dependency scan files generated by the compiler.
7575
1. The build system reads the dependency scan files and determines to build `b.h.ifc` first.

docs/build/reference/zc-conformance.md

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
title: "/Zc (Conformance)"
33
description: "The /Zc conformance compiler options enable or disable support for conforming or backward-compatible behavior."
4-
ms.date: 12/02/2021
4+
ms.date: 11/08/2022
55
helpviewer_keywords: ["/Zc compiler options [C++]", "-Zc compiler options [C++]", "Conformance compiler options", "Zc compiler options [C++]"]
66
---
77
# `/Zc` (Conformance)
@@ -22,10 +22,12 @@ Here are the **`/Zc`** compiler options:
2222

2323
| Option | Behavior |
2424
|--|--|
25+
| [`/Zc:__cplusplus`](zc-cplusplus.md) | Enable the `__cplusplus` macro to report the supported standard (off by default). |
26+
| [`/Zc:__STDC__`](zc-stdc.md) | Enable the `__STDC__` macro to report the C standard is supported (off by default). |
2527
| [`/Zc:alignedNew`](zc-alignednew.md) | Enable C++17 over-aligned dynamic allocation (on by default in C++17). |
2628
| [`/Zc:auto`](zc-auto-deduce-variable-type.md) | Enforce the new Standard C++ meaning for **`auto`** (on by default). |
2729
| [`/Zc:char8_t`](zc-char8-t.md) | Enable or disable C++20 native `u8` literal support as `const char8_t` (off by default, except under **`/std:c++20`**). |
28-
| [`/Zc:__cplusplus`](zc-cplusplus.md) | Enable the `__cplusplus` macro to report the supported standard (off by default). |
30+
| [`/Zc:enumTypes[-]`](zc-enumtypes.md) | Enable Standard C++ rules for `enum` type deduction (off by default). |
2931
| [`/Zc:externC`](zc-externc.md) | Enforce Standard C++ rules for `extern "C"` functions (implied by **`/permissive-`**). |
3032
| [`/Zc:externConstexpr`](zc-externconstexpr.md) | Enable external linkage for **`constexpr`** variables (off by default). |
3133
| [`/Zc:forScope`](zc-forscope-force-conformance-in-for-loop-scope.md) | Enforce Standard C++ **`for`** scoping rules (on by default). |
@@ -43,9 +45,11 @@ Here are the **`/Zc`** compiler options:
4345
| [`/Zc:ternary`](zc-ternary.md) | Enforce conditional operator rules on operand types (off by default). |
4446
| [`/Zc:threadSafeInit`](zc-threadsafeinit-thread-safe-local-static-initialization.md) | Enable thread-safe local static initialization (on by default). |
4547
| [`/Zc:throwingNew`](zc-throwingnew-assume-operator-new-throws.md) | Assume **`operator new`** throws on failure (off by default). |
48+
| [`/Zc:tlsGuards[-]`](zc-tlsguards.md) | Generate runtime checks for TLS variable initialization (on by default). |
4649
| [`/Zc:trigraphs`](zc-trigraphs-trigraphs-substitution.md) | Enable trigraphs (obsolete, off by default). |
4750
| [`/Zc:twoPhase`](zc-twophase.md) | Use non-conforming template parsing behavior (conforming by default). |
4851
| [`/Zc:wchar_t`](zc-wchar-t-wchar-t-is-native-type.md) | **`wchar_t`** is a native type, not a typedef (on by default). |
52+
| [`/Zc:zeroSizeArrayNew[-]`](zc-zerosizearraynew.md) | Call member `new`/`delete` for 0-size arrays of objects (on by default). |
4953

5054
For more information about conformance issues in MSVC, see [Nonstandard behavior](../../cpp/nonstandard-behavior.md).
5155

docs/build/reference/zc-tlsguards.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
description: "Learn more about the /Zc:tlsGuards (Check TLS initialization) compiler option."
3+
title: "/Zc:tlsGuards (Check TLS initialization)"
4+
ms.date: 11/08/2022
5+
f1_keywords: ["/Zc:tlsGuards"]
6+
helpviewer_keywords: ["-Zc:tlsGuards compiler option (C++)", "/Zc:tlsGuards compiler option (C++)"]
7+
---
8+
# `/Zc:tlsGuards` (Check TLS initialization)
9+
10+
The **`/Zc:tlsGuards`** compiler option generates runtime checks for thread local storage (TLS) initialization in DLLs.
11+
12+
## Syntax
13+
14+
> **`/Zc:tlsGuards`**\[**`-`**]
15+
16+
## Remarks
17+
18+
The **`/Zc:tlsGuards`** compiler option enables checks for initialization of thread-local variables in DLLs. Previously, thread-local variables in DLLs weren't correctly initialized. Other than on the thread that loaded the DLL, they weren't initialized before first use on threads that existed before the DLL was loaded. The **`/Zc:tlsGuards`** option enables code that corrects this defect. Thread-local variables in such a DLL get initialized immediately before their first use on such threads.
19+
20+
The **`/Zc:tlsGuards`** option is new in Visual Studio 2019 version 16.5. This option is on by default in all compiler modes. The new behavior of testing for initialization on uses of thread-local variables may be disabled by using the **`/Zc:tlsGuards-`** compiler option. To disable checks for specific thread-local variables, use the [`[[msvc:no_tls_guard]]`](../../cpp/attributes.md) attribute.
21+
22+
### To set this compiler option in Visual Studio
23+
24+
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
25+
26+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
27+
28+
1. In **Additional options**, add *`/Zc:tlsGuards`*. Choose **OK** or **Apply** to save your changes.
29+
30+
## See also
31+
32+
[`/Zc` (Conformance)](zc-conformance.md)\
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
---
2+
description: "Learn more about the /Zc:zeroSizeArrayNew (Call member new/delete on arrays) compiler option."
3+
title: "/Zc:zeroSizeArrayNew (Call member new/delete on arrays)"
4+
ms.date: 11/08/2022
5+
f1_keywords: ["/Zc:zeroSizeArrayNew"]
6+
helpviewer_keywords: ["-Zc:zeroSizeArrayNew compiler option (C++)", "/Zc:zeroSizeArrayNew compiler option (C++)"]
7+
---
8+
# `/Zc:zeroSizeArrayNew` (Call member new/delete on arrays)
9+
10+
The **`/Zc:zeroSizeArrayNew`** compiler option calls member `new` and `delete` for zero-length arrays of objects.
11+
12+
## Syntax
13+
14+
> **`/Zc:zeroSizeArrayNew`**\[**`-`**]
15+
16+
## Remarks
17+
18+
The **`/Zc:zeroSizeArrayNew`** compiler option enables calls to member `new` and `delete` for zero-length arrays of objects of class types with virtual destructors. This behavior conforms to the standard. This compiler option is new in Visual Studio 2019 version 16.9 and is enabled by default in all compiler modes. Previously, in code compiled by versions before Visual Studio 2019 version 16.9, the compiler invoked global `new` and `delete` on zero-length arrays of objects of class types with virtual destructors.
19+
20+
The **`/Zc:zeroSizeArrayNew`** option may cause a breaking change in code that relied on the previous non-conforming behavior. To restore the previous behavior, use the **`/Zc:zeroSizeArrayNew-`** compiler option.
21+
22+
### To set this compiler option in Visual Studio
23+
24+
1. Open the project's **Property Pages** dialog box. For details, see [Set C++ compiler and build properties in Visual Studio](../working-with-project-properties.md).
25+
26+
1. Select the **Configuration Properties** > **C/C++** > **Command Line** property page.
27+
28+
1. In **Additional options**, add *`/Zc:zeroSizeArrayNew`* or *`/Zc:zeroSizeArrayNew-`*. Choose **OK** or **Apply** to save your changes.
29+
30+
## See also
31+
32+
[`/Zc` (Conformance)](zc-conformance.md)\

docs/build/toc.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -811,16 +811,20 @@ items:
811811
href: ../build/reference/zc-strictstrings-disable-string-literal-type-conversion.md
812812
- name: "/Zc:ternary (Enforce conditional operator rules)"
813813
href: ../build/reference/zc-ternary.md
814-
- name: "/Zc:threadSafeInit (Thread-safe local static initialization)"
814+
- name: "/Zc:threadSafeInit (Thread-safe local static initialization)"
815815
href: ../build/reference/zc-threadsafeinit-thread-safe-local-static-initialization.md
816816
- name: "/Zc:throwingNew (Assume operator new throws)"
817817
href: ../build/reference/zc-throwingnew-assume-operator-new-throws.md
818+
- name: "/Zc:tlsGuards (Check TLS initialization)"
819+
href: ../build/reference/zc-tlsguards.md
818820
- name: "/Zc:trigraphs (Trigraphs substitution)"
819821
href: ../build/reference/zc-trigraphs-trigraphs-substitution.md
820822
- name: "/Zc:twoPhase- (disable two-phase name lookup)"
821823
href: ../build/reference/zc-twophase.md
822824
- name: "/Zc:wchar_t (wchar_t is native type)"
823825
href: ../build/reference/zc-wchar-t-wchar-t-is-native-type.md
826+
- name: "/Zc:zeroSizeArrayNew (Call member new/delete on arrays)"
827+
href: ../build/reference/zc-zerosizearraynew.md
824828
- name: /Zf (Faster PDB generation)
825829
href: ../build/reference/zf.md
826830
- name: /Zg (Generate function prototypes)

0 commit comments

Comments
 (0)