Skip to content

Commit 790aedc

Browse files
author
Colin Robertson
committed
Update /Za for cpp-docs issue 801
1 parent ce8efb2 commit 790aedc

File tree

1 file changed

+18
-16
lines changed

1 file changed

+18
-16
lines changed
Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,50 +1,52 @@
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 the **Deprecated and Removed Compiler Options** section in [Compiler Options Listed by Category](compiler-options-listed-by-category.md).
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 **/Za** option disables Microsoft extensions to ANSI C89/ISO C90 when code is compiled as C.
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 Microsoft C/C++ compiler supports compilation of C code in two ways:
2725

28-
Other compiler options used with **/Za** can affect how the compiler ensures standards conformance.
26+
- 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 the **/Za** option is 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.
2927

30-
For ways to specify specific standards-conformant behavior settings, see the [/Zc](../../build/reference/zc-conformance.md) compiler option.
28+
- 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.
29+
30+
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 settings. For additional C++ standard conformance settings, see the [/permissive-](permissive-standards-conformance.md) and [/std](std-specify-language-standard-version.md) compiler options.
3131

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

3434
### To set this compiler option in the Visual Studio development environment
3535

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

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

4040
1. Modify the **Disable Language Extensions** property.
4141

4242
### To set this compiler option programmatically
4343

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

4646
## See Also
4747

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)
48+
[Compiler Options](compiler-options.md)<br/>
49+
[Setting Compiler Options](setting-compiler-options.md)<br/>
50+
[/Zc (Conformance)](zc-conformance.md)<br/>
51+
[/permissive- (Standards conformance)](permissive-standards-conformance.md)<br/>
52+
[/std (Specify Language Standard Version)](std-specify-language-standard-version.md)<br/>

0 commit comments

Comments
 (0)