|
1 | 1 | ---
|
2 | 2 | title: "/Za, /Ze (Disable Language Extensions)"
|
3 |
| -ms.date: "11/04/2016" |
| 3 | +ms.date: "02/19/2019" |
4 | 4 | f1_keywords: ["VC.Project.VCCLWCECompilerTool.DisableLanguageExtensions", "/za", "/ze", "VC.Project.VCCLCompilerTool.DisableLanguageExtensions"]
|
5 | 5 | 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++]"]
|
6 | 6 | ms.assetid: 65e49258-7161-4289-a176-7c5c0656b1a2
|
7 | 7 | ---
|
8 | 8 | # /Za, /Ze (Disable Language Extensions)
|
9 | 9 |
|
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. |
11 | 11 |
|
12 | 12 | ## Syntax
|
13 | 13 |
|
14 |
| -``` |
15 |
| -/Za |
16 |
| -/Ze |
17 |
| -``` |
| 14 | +> **/Za**<br/> |
| 15 | +> **/Ze** |
18 | 16 |
|
19 | 17 | ## Remarks
|
20 | 18 |
|
21 | 19 | > [!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). |
23 | 21 |
|
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: |
25 | 23 |
|
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. |
27 | 25 |
|
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. |
29 | 27 |
|
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. |
31 | 29 |
|
32 | 30 | For more information about conformance issues with Visual C++, see [Nonstandard Behavior](../../cpp/nonstandard-behavior.md).
|
33 | 31 |
|
34 | 32 | ### To set this compiler option in the Visual Studio development environment
|
35 | 33 |
|
36 | 34 | 1. Open the project's **Property Pages** dialog box. For details, see [Working with Project Properties](../../ide/working-with-project-properties.md).
|
37 | 35 |
|
38 |
| -1. In the navigation pane, choose **Configuration Properties**, **C/C++**, **Language**. |
| 36 | +1. In the navigation pane, choose **Configuration Properties** > **C/C++** > **Language**. |
39 | 37 |
|
40 | 38 | 1. Modify the **Disable Language Extensions** property.
|
41 | 39 |
|
42 | 40 | ### To set this compiler option programmatically
|
43 | 41 |
|
44 |
| -- See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.DisableLanguageExtensions%2A>. |
| 42 | +See <xref:Microsoft.VisualStudio.VCProjectEngine.VCCLCompilerTool.DisableLanguageExtensions%2A>. |
45 | 43 |
|
46 | 44 | ## See Also
|
47 | 45 |
|
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