Skip to content

Commit 3c59449

Browse files
author
Colin Robertson
authored
Merge pull request MicrosoftDocs#2364 from MicrosoftDocs/master637329378499860270
Repo sync for protected CLA branch
2 parents 58fdd81 + 50db6d0 commit 3c59449

File tree

4 files changed

+76
-60
lines changed

4 files changed

+76
-60
lines changed

docs/atl/reference/aggregation-and-class-factory-macros.md

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,28 @@
11
---
22
title: "Aggregation and Class Factory Macros"
3-
ms.date: "11/04/2016"
4-
f1_keywords: ["atlcom/ATL::DECLARE_AGGREGATABLE", "atlcom/ATL::DECLARE_CLASSFACTORY", "atlcom/ATL::DECLARE_CLASSFACTORY_EX", "atlcom/ATL::DECLARE_CLASSFACTORY_AUTO_THREAD", "atlcom/ATL::DECLARE_CLASSFACTORY_SINGLETON", "atlcom/ATL::DECLARE_GET_CONTROLLING_UNKNOWN", "atlcom/ATL::DECLARE_NOT_AGGREGATABLE", "atlcom/ATL::DECLARE_ONLY_AGGREGATABLE", "atlcom/ATL::DECLARE_POLY_AGGREGATABLE", "atlcom/ATL::DECLARE_PROTECT_FINAL_CONSTRUCT", "atlcom/ATL::DECLARE_VIEW_STATUS"]
5-
helpviewer_keywords: ["class factories, ATL macros", "aggregation [C++], ATL macros"]
3+
ms.date: 08/12/2020
4+
f1_keywords: ["ATLCOM/ATL::DECLARE_AGGREGATABLE", "ATLCOM/ATL::DECLARE_CLASSFACTORY", "ATLCOM/ATL::DECLARE_CLASSFACTORY_EX", "ATLCOM/ATL::DECLARE_CLASSFACTORY_AUTO_THREAD", "ATLCOM/ATL::DECLARE_CLASSFACTORY_SINGLETON", "ATLCOM/ATL::DECLARE_GET_CONTROLLING_UNKNOWN", "ATLCOM/ATL::DECLARE_NOT_AGGREGATABLE", "ATLCOM/ATL::DECLARE_ONLY_AGGREGATABLE", "ATLCOM/ATL::DECLARE_POLY_AGGREGATABLE", "ATLCOM/ATL::DECLARE_PROTECT_FINAL_CONSTRUCT", "ATLCOM/ATL::DECLARE_VIEW_STATUS", "ATLDEF/ATL::DECLARE_AGGREGATABLE", "ATLDEF/ATL::DECLARE_CLASSFACTORY", "ATLDEF/ATL::DECLARE_CLASSFACTORY_EX", "ATLDEF/ATL::DECLARE_CLASSFACTORY_AUTO_THREAD", "ATLDEF/ATL::DECLARE_CLASSFACTORY_SINGLETON", "ATLDEF/ATL::DECLARE_GET_CONTROLLING_UNKNOWN", "ATLDEF/ATL::DECLARE_NOT_AGGREGATABLE", "ATLDEF/ATL::DECLARE_ONLY_AGGREGATABLE", "ATLDEF/ATL::DECLARE_POLY_AGGREGATABLE", "ATLDEF/ATL::DECLARE_PROTECT_FINAL_CONSTRUCT", "ATLDEF/ATL::DECLARE_VIEW_STATUS", "ATLCOM/DECLARE_AGGREGATABLE", "ATLCOM/DECLARE_CLASSFACTORY", "ATLCOM/DECLARE_CLASSFACTORY_EX", "ATLCOM/DECLARE_CLASSFACTORY_AUTO_THREAD", "ATLCOM/DECLARE_CLASSFACTORY_SINGLETON", "ATLCOM/DECLARE_GET_CONTROLLING_UNKNOWN", "ATLCOM/DECLARE_NOT_AGGREGATABLE", "ATLCOM/DECLARE_ONLY_AGGREGATABLE", "ATLCOM/DECLARE_POLY_AGGREGATABLE", "ATLCOM/DECLARE_PROTECT_FINAL_CONSTRUCT", "ATLCOM/DECLARE_VIEW_STATUS", "ATL::DECLARE_AGGREGATABLE", "ATL::DECLARE_CLASSFACTORY", "ATL::DECLARE_CLASSFACTORY_EX", "ATL::DECLARE_CLASSFACTORY_AUTO_THREAD", "ATL::DECLARE_CLASSFACTORY_SINGLETON", "ATL::DECLARE_GET_CONTROLLING_UNKNOWN", "ATL::DECLARE_NOT_AGGREGATABLE", "ATL::DECLARE_ONLY_AGGREGATABLE", "ATL::DECLARE_POLY_AGGREGATABLE", "ATL::DECLARE_PROTECT_FINAL_CONSTRUCT", "ATL::DECLARE_VIEW_STATUS", "DECLARE_AGGREGATABLE", "DECLARE_CLASSFACTORY", "DECLARE_CLASSFACTORY_EX", "DECLARE_CLASSFACTORY_AUTO_THREAD", "DECLARE_CLASSFACTORY_SINGLETON", "DECLARE_GET_CONTROLLING_UNKNOWN", "DECLARE_NOT_AGGREGATABLE", "DECLARE_ONLY_AGGREGATABLE", "DECLARE_POLY_AGGREGATABLE", "DECLARE_PROTECT_FINAL_CONSTRUCT", "DECLARE_VIEW_STATUS"]
5+
helpviewer_keywords: ["class factories, ATL macros", "aggregation [C++], ATL macros", "ATL::DECLARE_AGGREGATABLE", "ATL::DECLARE_CLASSFACTORY", "ATL::DECLARE_CLASSFACTORY_EX", "ATL::DECLARE_CLASSFACTORY_AUTO_THREAD", "ATL::DECLARE_CLASSFACTORY_SINGLETON", "ATL::DECLARE_GET_CONTROLLING_UNKNOWN", "ATL::DECLARE_NOT_AGGREGATABLE", "ATL::DECLARE_ONLY_AGGREGATABLE", "ATL::DECLARE_POLY_AGGREGATABLE", "ATL::DECLARE_PROTECT_FINAL_CONSTRUCT", "ATL::DECLARE_VIEW_STATUS"]
66
ms.assetid: d99d379a-0eec-481f-8daa-252dac18f163
77
---
88
# Aggregation and Class Factory Macros
99

1010
These macros provide ways of controlling aggregation and of declaring class factories.
1111

12-
|||
13-
|-|-|
14-
|[DECLARE_AGGREGATABLE](#declare_aggregatable)|Declares that your object can be aggregated (the default).|
15-
|[DECLARE_CLASSFACTORY](#declare_classfactory)|Declares the class factory to be [CComClassFactory](../../atl/reference/ccomclassfactory-class.md), the ATL default class factory.|
16-
|[DECLARE_CLASSFACTORY_EX](#declare_classfactory_ex)|Declares your class factory object to be the class factory.|
17-
|[DECLARE_CLASSFACTORY2](#declare_classfactory2)|Declares [CComClassFactory2](../../atl/reference/ccomclassfactory2-class.md) to be the class factory.|
18-
|[DECLARE_CLASSFACTORY_AUTO_THREAD](#declare_classfactory_auto_thread)|Declares [CComClassFactoryAutoThread](../../atl/reference/ccomclassfactoryautothread-class.md) to be the class factory.|
19-
|[DECLARE_CLASSFACTORY_SINGLETON](#declare_classfactory_singleton)|Declares [CComClassFactorySingleton](../../atl/reference/ccomclassfactorysingleton-class.md) to be the class factory.|
20-
|[DECLARE_GET_CONTROLLING_UNKNOWN](#declare_get_controlling_unknown)|Declares a virtual `GetControllingUnknown` function.|
21-
|[DECLARE_NOT_AGGREGATABLE](#declare_not_aggregatable)|Declares that your object cannot be aggregated.|
22-
|[DECLARE_ONLY_AGGREGATABLE](#declare_only_aggregatable)|Declares that your object must be aggregated.|
23-
|[DECLARE_POLY_AGGREGATABLE](#declare_poly_aggregatable)|Checks the value of the outer unknown and declares your object aggregatable or not aggregatable, as appropriate.|
24-
|[DECLARE_PROTECT_FINAL_CONSTRUCT](#declare_protect_final_construct)|Protects the outer object from deletion during construction of an inner object.|
25-
|[DECLARE_VIEW_STATUS](#declare_view_status)|Specifies the VIEWSTATUS flags to the container.|
12+
| Macro | Description |
13+
|--|--|
14+
| [DECLARE_AGGREGATABLE](#declare_aggregatable) | Declares that your object can be aggregated (the default). |
15+
| [DECLARE_CLASSFACTORY](#declare_classfactory) | Declares the class factory to be [CComClassFactory](../../atl/reference/ccomclassfactory-class.md), the ATL default class factory. |
16+
| [DECLARE_CLASSFACTORY_EX](#declare_classfactory_ex) | Declares your class factory object to be the class factory. |
17+
| [DECLARE_CLASSFACTORY2](#declare_classfactory2) | Declares [CComClassFactory2](../../atl/reference/ccomclassfactory2-class.md) to be the class factory. |
18+
| [DECLARE_CLASSFACTORY_AUTO_THREAD](#declare_classfactory_auto_thread) | Declares [CComClassFactoryAutoThread](../../atl/reference/ccomclassfactoryautothread-class.md) to be the class factory. |
19+
| [DECLARE_CLASSFACTORY_SINGLETON](#declare_classfactory_singleton) | Declares [CComClassFactorySingleton](../../atl/reference/ccomclassfactorysingleton-class.md) to be the class factory. |
20+
| [DECLARE_GET_CONTROLLING_UNKNOWN](#declare_get_controlling_unknown) | Declares a virtual `GetControllingUnknown` function. |
21+
| [DECLARE_NOT_AGGREGATABLE](#declare_not_aggregatable) | Declares that your object cannot be aggregated. |
22+
| [DECLARE_ONLY_AGGREGATABLE](#declare_only_aggregatable) | Declares that your object must be aggregated. |
23+
| [DECLARE_POLY_AGGREGATABLE](#declare_poly_aggregatable) | Checks the value of the outer unknown and declares your object aggregatable or not aggregatable, as appropriate. |
24+
| [DECLARE_PROTECT_FINAL_CONSTRUCT](#declare_protect_final_construct) | Protects the outer object from deletion during construction of an inner object. |
25+
| [DECLARE_VIEW_STATUS](#declare_view_status) | Specifies the VIEWSTATUS flags to the container. |
2626

2727
## Requirements
2828

Lines changed: 35 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,36 @@
11
---
22
title: "Advanced Property Page (Project)"
3-
ms.date: "07/19/2019"
3+
ms.date: 08/10/2020
44
f1_keywords: ["VC.Project.VCConfiguration.VCToolsVersion"]
55
ms.description: "Use the Advanced property page in Visual Studio 2019 to set various properties for C++ projects."
66
---
77
# Advanced Property Page
88

9-
The Advanced property page is available in Visual Studio 2019 and later.
9+
::: moniker range="<=vs-2017"
10+
11+
The Advanced property page is available in Visual Studio 2019 and later. To see the documentation for that version, set the Visual Studio **Version** selector control for this article to Visual Studio 2019. It's found at the top of the table of contents on this page.
12+
13+
::: moniker-end
1014

1115
::: moniker range="vs-2019"
1216

17+
The Advanced property page is available in Visual Studio 2019 and later.
18+
1319
## Advanced Properties
1420

1521
- **Target File Extension**
1622

17-
Specifies the file extension to use for the build output. Defaults to **.exe** for applications, **.lib** for static libraries and **.dll** for DLLs.
23+
Specifies the file extension to use for the build output. Defaults to *`.exe`* for applications, *`.lib`* for static libraries and *`.dll`* for DLLs.
1824

1925
- **Extensions to Delete on Clean**
2026

21-
The **Clean** option (**Build** menu) deletes files from the intermediate directory where a project's configuration is built. Files with extensions specified with this property will be deleted when **Clean** is run or when you perform a rebuild. In addition to files of these extensions in the intermediate directory, the build system will also delete any known output of the build regardless of where it is located (including intermediate outputs such as .obj files). Note that you can specify wildcard characters.
27+
The **Clean** option (**Build** menu) deletes files from the intermediate directory where a project's configuration is built. Files with extensions specified in this property get deleted when **Clean** is run or when you rebuild. The build system deletes any files that have these extensions in the intermediate directory. It also deletes any known output of the build, no matter where it's located. (That includes the intermediate outputs such as *`.obj`* files.) You can specify wildcard characters in this property.
2228

2329
To programmatically access this property, see <xref:Microsoft.VisualStudio.VCProjectEngine.VCConfiguration.DeleteExtensionsOnClean%2A>.
2430

2531
- **Build Log File**
2632

27-
Allows you to specify a non-default location for the log file that is created whenever you build a project. The default location is specified by the macros $(IntDir)$(MSBuildProjectName).log.
33+
Allows you to specify a non-default location for the log file that's created whenever you build a project. The default location is specified by the macros `$(IntDir)$(MSBuildProjectName).log`.
2834

2935
You can use project macros to change the directory location. See [Common macros for build commands and properties](common-macros-for-build-commands-and-properties.md).
3036

@@ -34,37 +40,53 @@ The Advanced property page is available in Visual Studio 2019 and later.
3440

3541
- **Use Debug Libraries**
3642

37-
Specifies whether to create a DEBUG or RELEASE build.
43+
Specifies whether to create a Debug or Release build.
3844

3945
- **Enable Unity (JUMBO) build**
4046

41-
Enables a build process where many C++ source files are combined into one or more "unity" files before compilation to improve build performance. Unrelated to the Unity game engine.
47+
Enables a faster build process that combines many C++ source files into one or more files before compilation. These combined files are known as *unity* files. They're unrelated to the Unity game engine.
48+
49+
- **Copy Content to OutDir**
50+
51+
Copy the items marked as *content* in the project to the project's output directory (`$(OutDir)`). This setting can simplify deployment. This property is available starting in Visual Studio 2019 version 16.7.
52+
53+
- **Copy Project References to OutDir**
54+
55+
Copy the executable (DLL and EXE file) project reference items to the project's output directory (`$(OutDir)`). In C++/CLI ([`/clr`](clr-common-language-runtime-compilation.md)) projects, this property is ignored. Instead, the **Copy Local** property on each project reference controls whether it's copied to the output directory. This setting can simplify local deployment. It's available starting in Visual Studio 2019 version 16.7.
56+
57+
- **Copy Project References' Symbols to OutDir**
58+
59+
Copy the PDB files for project reference items along with the project reference executable items to the project's output directory (`$(OutDir)`). This property is always enabled for C++/CLI projects. This setting can simplify debug deployment. It's available starting in Visual Studio 2019 version 16.7.
60+
61+
- **Copy C++ Runtime to OutDir**
62+
63+
Copy the runtime DLLs to the project's output directory (`$(OutDir)`). This setting can simplify local deployment. It's available starting in Visual Studio 2019 version 16.7.
4264

4365
- **Use of MFC**
4466

45-
Specifies whether the MFC project will statically or dynamically link to the MFC DLL. Non-MFC projects can select **Use Standard Windows Libraries** to link to various Win32 libraries that are included when you use MFC.
67+
Specifies whether the MFC project statically or dynamically links to the MFC DLL. In non-MFC projects, select **Use Standard Windows Libraries** to link the Win32 libraries included by MFC.
4668

4769
To programmatically access this property, see <xref:Microsoft.VisualStudio.VCProject.VCProjectConfigurationProperties.useOfMfc%2A>.
4870

4971
- **Character Set**
5072

51-
Defines whether _UNICODE or _MBCS should be set. Also affects the linker entry point where appropriate.
73+
Defines whether `_UNICODE` or `_MBCS` should be set. Also affects the linker entry point where appropriate.
5274

5375
To programmatically access this property, see <xref:Microsoft.VisualStudio.VCProject.VCProjectConfigurationProperties.CharacterSet%2A>.
5476

5577
- **Whole Program Optimization**
5678

57-
Specifies the [/GL](gl-whole-program-optimization.md) compiler option and [/LTCG](ltcg-link-time-code-generation.md) linker option. By default, this is disabled for Debug configurations, and enabled for Retail configurations.
79+
Specifies the [`/GL`](gl-whole-program-optimization.md) compiler option and [`/LTCG`](ltcg-link-time-code-generation.md) linker option. By default, whole program optimization is disabled for Debug configurations, and enabled for Release configurations.
5880

5981
- **MSVC Toolset Version**
6082

61-
Specifies the full version of the MSVC toolset that will be used to build the project. If you have various update and preview versions of a toolset installed, you can specify which one to use here.
83+
Specifies the full version of the MSVC toolset that's used to build the project. You may have various update and preview versions of a toolset installed. You can specify which one to use here.
6284

6385
## C++/CLI Properties
6486

6587
- **Common Language Runtime support**
6688

67-
Causes the [/clr](clr-common-language-runtime-compilation.md) compiler option to be used.
89+
Causes the [`/clr`](clr-common-language-runtime-compilation.md) compiler option to be used.
6890

6991
To programmatically access this property, see <xref:Microsoft.VisualStudio.VCProject.VCProjectConfigurationProperties.ManagedExtensions%2A>.
7092

@@ -74,6 +96,6 @@ The Advanced property page is available in Visual Studio 2019 and later.
7496

7597
- **Enable Managed Incremental Build**
7698

77-
For managed projects, this enables detection of external visibility when you generate assemblies. If a change to a managed project is not visible to other projects, then dependent projects are not rebuilt. This can dramatically improve build times in solutions that include managed projects.
99+
For managed projects, this option enables detection of external visibility when you generate assemblies. If a change to a managed project isn't visible to other projects, dependent projects aren't rebuilt. Managed incremental builds can dramatically improve build times in solutions that include managed projects.
78100

79101
::: moniker-end

docs/code-quality/c26474.md

Lines changed: 23 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,41 @@
11
---
22
title: C26474
3-
ms.date: 11/15/2017
3+
ms.date: 08/11/2020
44
ms.topic: "conceptual"
55
f1_keywords: ["C26474"]
66
helpviewer_keywords: ["C26474"]
77
ms.assetid: 1e23a8e6-97fa-47f5-a279-b52aa2efafa4
8-
98
---
109
# C26474 NO_IMPLICIT_CAST
1110

1211
"Don't cast between pointer types when the conversion could be implicit."
1312

14-
**C++ Core Guidelines**:
13+
**C++ Core Guidelines**:\
1514
Type.1: Avoid casts
1615

17-
In some cases, implicit casts between pointer types can safely be done and dont require user to write specific cast expression. This rule finds instances of such unnecessary casting which can be removed.
16+
In some cases, implicit casts between pointer types are safe and don't require you to write a specific cast expression. This rule finds instances of unnecessary casts you can safely remove.
1817

1918
## Remarks
2019

21-
- The rule ID is a bit misleading: it should be interpreted as "implicit cast is not used where it is acceptable".
22-
- The rule is applicable to pointers only and checks static casts and reinterpret casts.
23-
- The following cases are acceptable pointer conversions that should not use explicit cast expressions:
24-
- conversion to nullptr_t;
25-
- conversion to void*;
26-
- conversion from a derived type to its base when invoking a base member function that is not hidden by the derived type.
20+
The rule ID should be interpreted as "An implicit cast isn't used where it's acceptable."
21+
22+
This rule is only applicable to pointers. It checks static casts and reinterpret casts.
23+
24+
These cases are acceptable pointer conversions that shouldn't use explicit cast expressions:
25+
- conversion to `nullptr_t`;
26+
- conversion to `void*`;
27+
- conversion from a derived type to its base when invoking a base member function that's not hidden by the derived type.
2728

2829
## Example 1
2930

30-
unnecessary conversion hides logic error
31+
An unnecessary conversion hides a logic error in this example:
3132

3233
```cpp
3334
template<class T>
3435
bool register_buffer(T buffer) {
3536
auto p = reinterpret_cast<void*>(buffer); // C26474, also 26490 NO_REINTERPRET_CAST
37+
// To fix, declare buffer as T*, and use this to define p:
38+
// auto p = buffer;
3639
return buffers_.insert(p).second;
3740
}
3841

@@ -47,35 +50,26 @@ void merge_bytes(std::uint8_t *left, std::uint8_t *right)
4750
}
4851
```
4952
50-
unnecessary conversion hides logic error - reworked
53+
## Example 2
5154
52-
```cpp
53-
// ...
54-
template<class T>
55-
bool register_buffer(T *buffer) {
56-
auto p = buffer;
57-
return buffers_.insert(p).second;
58-
}
59-
// ...
60-
```
55+
This example demonstrates using casts to access base-class member functions:
6156
62-
## Example 2
63-
Using casts to access base-class member functions
6457
```cpp
6558
struct struct_1
6659
{
67-
void foo();
68-
void bar();
60+
void foo();
61+
void bar();
6962
};
63+
7064
struct struct_2 : struct_1
7165
{
72-
void foo(); // this definition hides struct_1::foo
66+
void foo(); // this definition hides struct_1::foo
7367
};
7468
7569
void fn(struct_2* ps2)
7670
{
77-
static_cast<struct_1*>(ps2)->foo(); // this cast is necessary to access `struct_1::foo`
78-
// alternatively ps2->struct_1::foo();
79-
static_cast<struct_1*>(ps2)->bar(); // this cast is unnecessary and can be done implicitly
71+
static_cast<struct_1*>(ps2)->foo(); // This cast is necessary to access struct_1::foo
72+
// Alternatively, use ps2->struct_1::foo();
73+
static_cast<struct_1*>(ps2)->bar(); // This cast is unnecessary and can be done implicitly
8074
}
8175
```

docs/overview/what-s-new-for-visual-cpp-in-visual-studio.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,7 @@ The Desktop Bridge infrastructure lets you package your existing desktop applica
631631

632632
A **Windows Application Packaging Project** project template is added, which greatly simplifies packaging of desktop applications with Desktop Bridge. It's available under **File | New | Project | Installed | Visual C++ | Universal Windows Platform**. For more information, see [Package an app by using Visual Studio (Desktop Bridge)](/windows/uwp/porting/desktop-to-uwp-packaging-dot-net).
633633

634-
When writing new code, you can now use C++/WinRT, a standard C++ language projection for the Windows Runtime implemented solely in header files. It allows you to consume and author Windows Runtime APIs using any standards-compliant C++ compiler. C++/WinRT is designed to provide C++ developers with first-class access to the modern Windows API. For more information, see [C++/WinRT: Modern C++ for the Windows Runtime](https://moderncpp.com/).
634+
When writing new code, you can now use C++/WinRT, a standard C++ language projection for the Windows Runtime implemented solely in header files. It allows you to consume and author Windows Runtime APIs using any standards-compliant C++ compiler. C++/WinRT is designed to provide C++ developers with first-class access to the modern Windows API. For more information, see [C++/WinRT](/windows/uwp/cpp-and-winrt-apis/).
635635

636636
Starting in build 17025 of the Windows SDK Insider Preview, C++/WinRT is included in the Windows SDK. For more information, see [C++/WinRT is now included the Windows SDK](https://devblogs.microsoft.com/cppblog/cppwinrt-is-now-included-the-windows-sdk/).
637637

0 commit comments

Comments
 (0)