Skip to content

Commit 9352538

Browse files
authored
Merge pull request #1781 from corob-msft/cr-fix-801
Update /Za for cpp-docs issue 801
2 parents 0262fe2 + b70fe0f commit 9352538

File tree

2 files changed

+24
-24
lines changed

2 files changed

+24
-24
lines changed

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ ms.assetid: c4750dcf-dba0-4229-99b6-45cdecc11729
88

99
This article contains a categorical list of compiler options. For an alphabetical list, see [Compiler Options Listed Alphabetically](compiler-options-listed-alphabetically.md).
1010

11-
### Optimization
11+
## Optimization
1212

1313
|Option|Purpose|
1414
|------------|-------------|
@@ -24,7 +24,7 @@ This article contains a categorical list of compiler options. For an alphabetica
2424
|[/Oy](oy-frame-pointer-omission.md)|Omits frame pointer. (x86 only)|
2525
|[/favor](favor-optimize-for-architecture-specifics.md)|Produces code that is optimized for a specified architecture, or for a range of architectures.|
2626

27-
### Code generation
27+
## Code generation
2828

2929
|Option|Purpose|
3030
|------------|-------------|
@@ -65,7 +65,7 @@ This article contains a categorical list of compiler options. For an alphabetica
6565
|[/RTC](rtc-run-time-error-checks.md)|Enables run-time error checking.|
6666
|[/volatile](volatile-volatile-keyword-interpretation.md)|Selects how the volatile keyword is interpreted.|
6767

68-
### Output files
68+
## Output files
6969

7070
|Option|Purpose|
7171
|------------|-------------|
@@ -80,7 +80,7 @@ This article contains a categorical list of compiler options. For an alphabetica
8080
|[/Fp](fp-name-dot-pch-file.md)|Specifies a precompiled header file name.|
8181
|[/FR, /Fr](fr-fr-create-dot-sbr-file.md)|Name generated .sbr browser files.|
8282

83-
### Preprocessor
83+
## Preprocessor
8484

8585
|Option|Purpose|
8686
|------------|-------------|
@@ -98,7 +98,7 @@ This article contains a categorical list of compiler options. For an alphabetica
9898
|[/u](u-u-undefine-symbols.md)|Removes all predefined macros.|
9999
|[/X](x-ignore-standard-include-paths.md)|Ignores the standard include directory.|
100100

101-
### Language
101+
## Language
102102

103103
|Option|Purpose|
104104
|------------|-------------|
@@ -122,7 +122,7 @@ This article contains a categorical list of compiler options. For an alphabetica
122122
|[/Zs](zs-syntax-check-only.md)|Checks syntax only.|
123123
|[/ZW](zw-windows-runtime-compilation.md)|Produces an output file to run on the Windows Runtime.|
124124

125-
### Linking
125+
## Linking
126126

127127
|Option|Purpose|
128128
|------------|-------------|
@@ -136,7 +136,7 @@ This article contains a categorical list of compiler options. For an alphabetica
136136
|[/MT](md-mt-ld-use-run-time-library.md)|Compiles to create a multithreaded executable file, by using LIBCMT.lib.|
137137
|[/MTd](md-mt-ld-use-run-time-library.md)|Compiles to create a debug multithreaded executable file, by using LIBCMTD.lib.|
138138

139-
### Miscellaneous
139+
## Miscellaneous
140140

141141
|Option|Purpose|
142142
|------------|-------------|
@@ -188,7 +188,7 @@ This article contains a categorical list of compiler options. For an alphabetica
188188
|[/permissive-](permissive-standards-conformance.md)|Set standard-conformance mode.|
189189
|[/std](std-specify-language-standard-version.md)|C++ standard version compatibility selector.|
190190

191-
### Deprecated and removed compiler options
191+
## Deprecated and removed compiler options
192192

193193
|Option|Purpose|
194194
|------------|-------------|
Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,50 @@
11
---
22
title: "/Za, /Ze (Disable Language Extensions)"
3-
ms.date: "11/04/2016"
3+
ms.date: "02/19/2019"
44
f1_keywords: ["VC.Project.VCCLWCECompilerTool.DisableLanguageExtensions", "/za", "/ze", "VC.Project.VCCLCompilerTool.DisableLanguageExtensions"]
55
helpviewer_keywords: ["-Za compiler option [C++]", "Za compiler option [C++]", "language extensions, disabling in compiler", "-Ze compiler option [C++]", "language extensions", "enable language extensions", "/Za compiler option [C++]", "/Ze compiler option [C++]", "Disable Language Extensions compiler option", "Ze compiler option [C++]"]
66
ms.assetid: 65e49258-7161-4289-a176-7c5c0656b1a2
77
---
88
# /Za, /Ze (Disable Language Extensions)
99

10-
The **/Za** compiler option emits an error for language constructs that are not compatible with ANSI C89 or ISO C++11. The **/Ze** compiler option, which is on by default, enables Microsoft extensions.
10+
The **/Za** compiler option disables and emits errors for Microsoft extensions to C that aren't compatible with ANSI C89/ISO C90. The deprecated **/Ze** compiler option enables Microsoft extensions. Microsoft extensions are enabled by default.
1111

1212
## Syntax
1313

14-
```
15-
/Za
16-
/Ze
17-
```
14+
> **/Za**<br/>
15+
> **/Ze**
1816
1917
## Remarks
2018

2119
> [!NOTE]
22-
> The **/Ze** option is deprecated because its behavior is on by default. We recommend you use the [/Zc (Conformance)](../../build/reference/zc-conformance.md) compiler options to control specific language extension features. For a list of deprecated compiler options, see the **Deprecated and Removed Compiler Options** section in [Compiler Options Listed by Category](../../build/reference/compiler-options-listed-by-category.md).
20+
> The use of **/Za** when code is compiled as C++ is not recommended. The **/Ze** option is deprecated because its behavior is on by default. For a list of deprecated compiler options, see [Deprecated and removed compiler options](compiler-options-listed-by-category.md#deprecated-and-removed-compiler-options).
2321
24-
The Visual C++ compiler offers a number of features beyond those specified in either the ANSI C89, ISO C99, or ISO C++ standards. These features are known collectively as Microsoft extensions to C and C++. These extensions are available by default, and not available when the **/Za** option is specified. For more information about specific extensions, see [Microsoft Extensions to C and C++](../../build/reference/microsoft-extensions-to-c-and-cpp.md).
22+
The Microsoft C/C++ compiler supports compilation of C code in two ways:
2523

26-
We recommend that you disable language extensions by specifying the **/Za** option if you plan to port your program to other environments. When **/Za** is specified, the compiler treats Microsoft extended keywords as simple identifiers, disables the other Microsoft extensions, and automatically defines the `__STDC__` predefined macro for C programs.
24+
- The compiler uses C compilation mode by default when a source file has a *.c* extension, or when the [/Tc](tc-tp-tc-tp-specify-source-file-type.md) or [/TC](tc-tp-tc-tp-specify-source-file-type.md) option is specified. The C compiler is an C89/C90 compiler that, by default, enables Microsoft extensions to the C language. For more information about specific extensions, see [Microsoft Extensions to C and C++](microsoft-extensions-to-c-and-cpp.md). When both C compilation and the **/Za** option are specified, the C compiler conforms strictly to the C89/C90 standard. The compiler treats Microsoft extended keywords as simple identifiers, disables the other Microsoft extensions, and automatically defines the [\_\_STDC\_\_](../../preprocessor/predefined-macros.md) predefined macro for C programs.
2725

28-
Other compiler options used with **/Za** can affect how the compiler ensures standards conformance.
26+
- The compiler can compile C code in C++ compilation mode. This behavior is the default for source files that don't have a *.c* extension, and when the [/Tp](tc-tp-tc-tp-specify-source-file-type.md) or [/TP](tc-tp-tc-tp-specify-source-file-type.md) option is specified. In C++ compilation mode, the compiler supports those parts of the ISO C99 and C11 standards that have been incorporated into the C++ standard. Almost all C code is also valid C++ code. A small number of C keywords and code constructs aren't valid C++ code, or are interpreted differently in C++. The compiler behaves according to the C++ standard in these cases. In C++ compilation mode, the **/Za** option may cause unexpected behavior and isn't recommended.
2927

30-
For ways to specify specific standards-conformant behavior settings, see the [/Zc](../../build/reference/zc-conformance.md) compiler option.
28+
Other compiler options can affect how the compiler ensures standards conformance. For ways to specify specific standard C and C++ behavior settings, see the [/Zc](zc-conformance.md) compiler option. For additional C++ standard conformance settings, see the [/permissive-](permissive-standards-conformance.md) and [/std](std-specify-language-standard-version.md) compiler options.
3129

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

3432
### To set this compiler option in the Visual Studio development environment
3533

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

38-
1. In the navigation pane, choose **Configuration Properties**, **C/C++**, **Language**.
36+
1. In the navigation pane, choose **Configuration Properties** > **C/C++** > **Language**.
3937

4038
1. Modify the **Disable Language Extensions** property.
4139

4240
### To set this compiler option programmatically
4341

44-
- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.DisableLanguageExtensions%2A>.
42+
See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.DisableLanguageExtensions%2A>.
4543

4644
## See Also
4745

48-
[Compiler Options](../../build/reference/compiler-options.md)<br/>
49-
[Setting Compiler Options](../../build/reference/setting-compiler-options.md)<br/>
50-
[/Zc (Conformance)](../../build/reference/zc-conformance.md)
46+
[Compiler Options](compiler-options.md)<br/>
47+
[Setting Compiler Options](setting-compiler-options.md)<br/>
48+
[/Zc (Conformance)](zc-conformance.md)<br/>
49+
[/permissive- (Standards conformance)](permissive-standards-conformance.md)<br/>
50+
[/std (Specify Language Standard Version)](std-specify-language-standard-version.md)<br/>

0 commit comments

Comments
 (0)