You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This article contains a categorical list of compiler options. For an alphabetical list, see [Compiler Options Listed Alphabetically](compiler-options-listed-alphabetically.md).
10
10
11
-
###Optimization
11
+
## Optimization
12
12
13
13
|Option|Purpose|
14
14
|------------|-------------|
@@ -24,7 +24,7 @@ This article contains a categorical list of compiler options. For an alphabetica
|[/favor](favor-optimize-for-architecture-specifics.md)|Produces code that is optimized for a specified architecture, or for a range of architectures.|
26
26
27
-
###Code generation
27
+
## Code generation
28
28
29
29
|Option|Purpose|
30
30
|------------|-------------|
@@ -65,7 +65,7 @@ This article contains a categorical list of compiler options. For an alphabetica
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.
You can copy resources from one file to another without changing them or you can change the language or condition of a resource while copying it.
12
+
- Copying and editing resources.
13
+
14
+
- Importing and exporting resources.
15
+
16
+
## Copy and Edit Resources
17
+
18
+
You can copy resources from one file to another without changing them, or changing the language or condition of a resource while copying it.
13
19
14
20
You can easily copy resources from an existing resource or executable file to your current resource file. To copy resources, you open both files containing resources at the same time and drag items from one file to another or copy and paste between the two files. This method works for resource script (.rc) files and resource template (.rct) files, and as executable (.exe) files.
15
21
16
22
> [!NOTE]
17
23
> Visual C++ includes sample resource files that you can use in your own application. For more information, see [CLIPART: Common Resources](https://github.com/Microsoft/VCSamples).
18
24
19
-
You can use the drag-and-drop method between .rc files that are open [outside of the project](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md).
25
+
You can use the drag-and-drop method between .rc files that are open outside of the project.
20
26
21
-
### To copy resources between files using the drag-and-drop method
27
+
### To copy resources
22
28
23
-
1. Open both resource files stand-alone (for more information, see [view resources in an .rc file outside of a project](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md)). For example, open *Source1.rc* and *Source2.rc*.
29
+
1. Open both resource files stand-alone (see how to [to open a resource script file](/how-to-create-a-resource-script-file#use-resource-script-files)). For example, open *Source1.rc* and *Source2.rc*.
24
30
25
-
1. Inside the first .rc file, select the resource you wish to copy. For example, in *Source1.rc*, select **IDD_DIALOG1**.
31
+
1. Inside the first .rc file, either:
26
32
27
-
1. Hold down the **Ctrl** key and drag the resource to the second .rc file. For example, drag**IDD_DIALOG1** from *Source1.rc* to *Source2.rc*.
33
+
- Use the drag-and-drop method
28
34
29
-
> [!NOTE]
30
-
> Dragging the resource without holding down the **Ctrl** key moves the resource rather than copying it.
35
+
1. Select the resource you wish to copy. For example, in *Source1.rc*, select **IDD_DIALOG1**.
31
36
32
-
### To copy resources using copy and paste
37
+
1. Hold down the **Ctrl** key and drag the resource to the second .rc file. For example, drag **IDD_DIALOG1** from *Source1.rc* to *Source2.rc*.
33
38
34
-
1. Open both resource files stand-alone (for more information, see [view resources in an .rc file outside of a project](../windows/how-to-open-a-resource-script-file-outside-of-a-project-standalone.md)). For example, *Source1.rc* and *Source2.rc*.
39
+
> [!TIP]
40
+
> Dragging the resource without holding down the **Ctrl** key moves the resource rather than copying it.
35
41
36
-
1. In the source file from which you wish to copy a resource (for example, *Source1.rc*), right-click a resource and choose **Copy** from the shortcut menu.
42
+
- Use the copy and paste method
37
43
38
-
1. Right-click the resource file into which you'd like to paste the resource (for example, *Source2.rc*). Choose **Paste** from the shortcut menu.
44
+
1. Right-click the resource you with to copy (for example, *Source1.rc*) and choose **Copy**.
39
45
40
-
> [!NOTE]
41
-
> You cannot drag and drop, copy, cut, or paste between resource files in the project (**Resource View**) and stand-alone .rc files (those open in document windows). You could do this in previous versions of the product.
46
+
1. Right-click the resource file into which you'd like to paste the resource (for example, *Source2.rc*) and choose **Paste**.
42
47
43
-
> [!NOTE]
44
-
> To avoid conflicts with symbol names or values in the existing file, Visual C++ may change the transferred resource's symbol value or symbol name and value when you copy it to the new file.
48
+
> [!NOTE]
49
+
> You can't drag and drop, copy, cut, or paste between resource files in the project (**Resource View**) and stand-alone .rc files (those open in document windows). You could do this in previous versions of the product.
45
50
46
-
### Change the language or condition of a resource while copying
51
+
> [!NOTE]
52
+
> To avoid conflicts with symbol names or values in the existing file, Visual C++ may change the transferred resource's symbol value or symbol name and value when you copy it to the new file.
47
53
48
54
While copying in a resource, you can change its language property or condition property, or both.
49
55
50
-
- The language of the resource identifies just that, the language for the resource. The language is used by [FindResource](/windows/desktop/api/winbase/nf-winbase-findresourcea) to help identify the resource for which you're looking. (However, resources can have differences for each language that aren't related to text, for example, accelerators that might only work on a Japanese keyboard or a bitmap that would only be appropriate for Chinese localized builds.)
56
+
- The language of a resource specifies the language used by [FindResource](/windows/desktop/api/winbase/nf-winbase-findresourcea) to help identify the resource for which you're looking. Resources can have differences for each language that aren't related to text, for example, accelerators that might only work on a Japanese keyboard or a bitmap that would only be appropriate for Chinese localized builds.
51
57
52
58
- The condition of a resource is a defined symbol that identifies a condition under which this particular copy of the resource is to be used.
53
59
54
-
The language and condition of a resource are shown in parentheses after the name of the resource in the **Workspace** window. In this example, the resource named `IDD_AboutBox` is using `Finnish` as its language and its condition is `XX33`.
60
+
The language and condition of a resource are shown in parentheses after the name of the resource in the **Workspace** window. Here the resource named `IDD_AboutBox` is using `Finnish` as its language and its condition is `XX33`:
55
61
56
62
```cpp
57
63
IDD_AboutBox (Finnish - XX33)
58
64
```
59
65
60
-
#### To copy an existing resource and change its language or condition
66
+
To copy an existing resource and change its language or condition
61
67
62
-
1. In the .rc file or in the [Resource View](../windows/resource-view-window.md) window, right-click the resource you want to copy.
63
-
64
-
1. Choose **Insert Copy** from the shortcut menu and set the following:
68
+
1. In the .rc file or in the [Resource View](../windows/resource-view-window.md) window, right-click the resource you want to copy and choose **Insert Copy**. Then set the following:
65
69
66
70
- For the **Language** list box, select the language.
67
71
68
72
- In the **Condition** box, type the condition.
69
73
70
-
## Edit Resources
74
+
### To edit resources
71
75
72
76
Managed resource files (.resx) are XML files. When you add a managed resource file to your project from the **Add New Item** dialog box, the **Managed Resources Editor** opens by default.
73
77
@@ -76,28 +80,24 @@ Managed resource files (.resx) are XML files. When you add a managed resource fi
76
80
You can import graphical resources (bitmaps, icons, cursors, and toolbars), HTML files, and custom resources for use in Visual C++. You can export the same types of files from a Visual C++ project to separate files that can be used outside the development environment.
77
81
78
82
> [!NOTE]
79
-
> Resource types such as accelerators, dialog boxes, and string tables cannot be imported or exported because they are not stand-alone file types.
80
-
81
-
### To import an individual resource into your current resource file
83
+
> Resource types such as accelerators, dialog boxes, and string tables can't be imported or exported because they're not stand-alone file types.
82
84
83
-
1. In [Resource View](../windows/resource-view-window.md), right-click the node for the resource script (*.rc) file to which you want to add a resource.
85
+
### To import a resource into the resource script file
84
86
85
-
1. Select **Import** on the shortcut menu.
87
+
1. In [Resource View](../windows/resource-view-window.md) right-click the node of the resource script (.rc) file to which you want to add a resource and select **Import**.
86
88
87
-
1. Locate and select the file name of the bitmap (.bmp), icon (.ico), cursor (.cur), Html file (.htm), or other file that you want to import.
89
+
1. Locate and choose the file name of the bitmap (.bmp), icon (.ico), cursor (.cur), html file (.htm), or other file to import.
88
90
89
-
1. Choose **OK** to add the resource to the selected file in **Resource** view.
91
+
1. Select **OK** to add the resource to the resource script file.
90
92
91
-
> [!NOTE]
92
-
> The import process works the same way no matter which particular resource type you have selected. The imported resource is automatically added to the correct node for that resource type.
93
-
94
-
### To export a bitmap, icon, or cursor as a separate file (for use outside of Visual C++)
93
+
> [!NOTE]
94
+
> The import process works the same no matter which resource type you have selected. The imported resource is automatically added to the correct node of that resource type.
95
95
96
-
1. In **Resource** view, right-click the resource you want to export.
96
+
### To export a resource for use outside of Visual C++
97
97
98
-
1. Select **Export** on the shortcut menu and accept the current file name or type a new one.
98
+
1. In [Resource View](../windows/resource-view-window.md), right-click the resource you want to export and select **Export**. You can accept the current file name or type a new one.
99
99
100
-
1. Navigate to the folder where you want to save the file and choose **Export**.
100
+
1. Navigate to the folder where you want to save the file and select **Export**.
0 commit comments