Skip to content

Repo sync for protected CLA branch #3384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions docs/atl/reference/compiler-options-macros.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ These macros control specific compiler features.
|[_ATL_ALL_WARNINGS](#_atl_all_warnings)|A symbol that enables errors in projects converted from previous versions of ATL.|
|[_ATL_APARTMENT_THREADED](#_atl_apartment_threaded)|Define if one or more of your objects use apartment threading.|
|[_ATL_CSTRING_EXPLICIT_CONSTRUCTORS](#_atl_cstring_explicit_constructors)|Makes certain `CString` constructors explicit, preventing any unintentional conversions.|
|[_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning)|Define this macro in order to use C++ standard compliant syntax, which generates the C4867 compiler error when a non-standard syntax is used to initialize a pointer to a member function.|
|[_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning)|Define this macro to require C++ standard syntax. It generates the C4867 compiler error when non-standard syntax is used to initialize a pointer to a member function.|
|[_ATL_FREE_THREADED](#_atl_free_threaded)|Define if one or more of your objects use free or neutral threading.|
|[_ATL_MULTI_THREADED](#_atl_multi_threaded)|A symbol that indicates the project will have objects that are marked as Both, Free or Neutral. The macro [_ATL_FREE_THREADED](#_atl_free_threaded) should be used instead.|
|[_ATL_NO_AUTOMATIC_NAMESPACE](#_atl_no_automatic_namespace)|A symbol that prevents the default use of namespace as ATL.|
|[_ATL_NO_COM_SUPPORT](#_atl_no_com_support)|A symbol that prevents COM-related code from being compiled with your project.|
|[ATL_NO_VTABLE](#atl_no_vtable)|A symbol that prevents the vtable pointer from being initialized in the class's constructor and destructor.|
|[ATL_NOINLINE](#atl_noinline)|A symbol that indicates a function should not be inlined.|
|[ATL_NOINLINE](#atl_noinline)|A symbol that indicates a function shouldn't be inlined.|
|[_ATL_SINGLE_THREADED](#_atl_single_threaded)|Define if all of your objects use the single threading model.|

## <a name="_atl_all_warnings"></a> _ATL_ALL_WARNINGS
Expand Down Expand Up @@ -56,7 +56,7 @@ By adding the following line to the *pch.h* (*stdafx.h* in Visual Studio 2017 an

[!code-cpp[NVC_ATL_Utilities#97](../../atl/codesnippet/cpp/compiler-options-macros_1.h)]

If this `#define` is added, the ATL headers are careful to preserve the state of these warnings so that they are not disabled globally (or if the user explicitly disables individual warnings, not to enable them).
If this `#define` is added, the ATL headers are careful to preserve the state of these warnings so that they're not disabled globally (or if the user explicitly disables individual warnings, not to enable them).

New projects have this `#define` set in *pch.h* (*stdafx.h* in Visual Studio 2017 and earlier) by default.

Expand All @@ -70,13 +70,13 @@ _ATL_APARTMENT_THREADED

### Remarks

Specifies apartment threading. See [Specifying the Project's Threading Model](../../atl/specifying-the-threading-model-for-a-project-atl.md) for other threading options, and [Options, ATL Simple Object Wizard](../../atl/reference/options-atl-simple-object-wizard.md) for a description of the threading models available for an ATL object.
Specifies apartment threading. For other options, and a description of the threading models available for an ATL object, see [Specifying the Project's Threading Model](../../atl/specifying-the-threading-model-for-a-project-atl.md) and [Options, ATL Simple Object Wizard](../../atl/reference/options-atl-simple-object-wizard.md).

## <a name="_atl_cstring_explicit_constructors"></a> _ATL_CSTRING_EXPLICIT_CONSTRUCTORS

Makes certain `CString` constructors explicit, preventing any unintentional conversions.

```
```cpp
_ATL_CSTRING_EXPLICIT_CONSTRUCTORS
```

Expand All @@ -88,19 +88,19 @@ By using the _T macro on all constructor string arguments, you can define _ATL_C

## <a name="_atl_enable_ptm_warning"></a> _ATL_ENABLE_PTM_WARNING

Define this macro in order to force the use of ANSI C++ standard-compliant syntax for pointer to member functions. Using this macro will cause the C4867 compiler error to be generated when non-standard syntax is used to initialize a pointer to a member function.
Define this macro in order to force the use of ANSI C++ standard-conforming syntax for pointer to member functions. Using this macro will cause the C4867 compiler error to be generated when non-standard syntax is used to initialize a pointer to a member function.

```
```cpp
#define _ATL_ENABLE_PTM_WARNING
```

### Remarks

The ATL and MFC libraries have been changed to match the Microsoft C++ compiler's improved standard C++ compliance. According to the ANSI C++ standard, the syntax of a pointer to a class member function should be `&CMyClass::MyFunc`.
The ATL and MFC libraries have been changed to match the Microsoft C++ compiler's improved standard C++ conformance. According to the ANSI C++ standard, the syntax of a pointer to a class member function should be `&CMyClass::MyFunc`.

When [_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning) is not defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define **_ATL_ENABLE_PTM_WARNING**, your code should be C++ standard compliant.
When [_ATL_ENABLE_PTM_WARNING](#_atl_enable_ptm_warning) is not defined (the default case), ATL/MFC disables the C4867 error in macro maps (notably message maps) so that code that was created in earlier versions can continue to build as before. If you define **_ATL_ENABLE_PTM_WARNING**, your code should conform to the C++ standard.

However, the non-standard form has been deprecated. You need to move existing code to C++ standard compliant syntax. For example, the following code:
However, the non-standard form has been deprecated. You need to move existing code to C++ standard syntax. For example, the following code:

[!code-cpp[NVC_MFCListView#14](../../atl/reference/codesnippet/cpp/compiler-options-macros_2.cpp)]

Expand Down
1 change: 1 addition & 0 deletions docs/build-insights/get-started-with-cpp-build-insights.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ title: "Get started with C++ Build Insights"
description: "A high-level overview of C++ Build Insights."
ms.date: "11/03/2019"
helpviewer_keywords: ["C++ Build Insights", "throughput analysis", "build time analysis", "vcperf.exe"]
ms.custom: intro-get-started
---
# Get started with C++ Build Insights

Expand Down
3 changes: 2 additions & 1 deletion docs/build-insights/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,13 @@ title: C++ Build Insights | Automate build tool chain analysis # < 60 chars
summary: Use C++ Build Insights for real-time and automated build analysis and optimization. # < 160 chars

metadata:
title: C++ Build Insights # Required; page title displayed in search results. Include the brand. < 60 chars.
title: C++ Build Insights
description: Learn how to use C++ Build Insights to analyze and optimize your builds.
ms.topic: landing-page
author: corob-msft
ms.author: corob
ms.date: 05/26/2020
ms.custom: intro-landing-hub

# linkListType: architecture | concept | deploy | download | get-started | how-to-guide | learn | overview | quickstart | reference | tutorial | video | whats-new

Expand Down
4 changes: 2 additions & 2 deletions docs/build/configuring-programs-for-windows-xp.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: "Configuring Programs for Windows XP"
description: "How to install and use the C++ Windows XP toolsets in Visual Studio."
ms.date: "03/16/2020"
ms.date: 09/17/2021
ms.assetid: 1e4487b3-d815-4123-878b-5718b22f0fd5
---
# Configuring Programs for Windows XP
Expand Down Expand Up @@ -95,7 +95,7 @@ Because of differences in platform and library support, the development experien
## Windows XP deployment

> [!IMPORTANT]
> Because it lacks support for SHA-256 code signing certificates, runtime library support for Windows XP is no longer available in the [latest Visual C++ Redistributable](https://support.microsoft.com/topic/the-latest-supported-visual-c-downloads-2647da03-1eea-4433-9aff-95f26a218cc0) for Visual Studio 2015, 2017, and 2019. The last redistributable to support Windows XP is version 16.7 (file version 14.27.29114.0). If your Windows XP apps are deployed with or updated to a later version of the redistributable, the apps won't run.
> Because it lacks support for SHA-256 code signing certificates, runtime library support for Windows XP is no longer available in the [latest Visual C++ Redistributable](../windows/latest-supported-vc-redist.md) for Visual Studio 2015, 2017, 2019, and 2022. The last Redistributable to support Windows XP shipped in Visual Studio 2019 version 16.7. Use a Redistributable that has a file version starting with **14.27**. If your Windows XP apps are deployed with or updated to a later version of the redistributable, the apps won't run.

If you're using a version of Visual Studio later than Visual Studio 2019 version 16.7, the redistributable files won't work on Windows XP. To get a copy of the redistributable files that support Windows XP, you'll need a Visual Studio account. Use the account you use to sign in to Visual Studio. Or, you can create an account for free at [my.visualstudio.com](https://my.visualstudio.com). The redistributable file is available in the Downloads section, as [Visual C++ Redistributable for Visual Studio 2019 - Version 16.7](https://my.visualstudio.com/Downloads?q=Redistributable%20for%20Visual%20Studio%202019%20Version%2016.7). To download the files, select the platform and language you need, and then choose the Download button.

Expand Down
1 change: 1 addition & 0 deletions docs/build/projects-and-build-systems-cpp.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ ms.date: "07/17/2019"
helpviewer_keywords: ["builds [C++]", "C++ projects, building", "projects [C++], building", "builds [C++], options", "C++, build options"]
ms.assetid: fa6ed4ff-334a-4d99-b5e2-a1f83d2b3008
ms.topic: "overview"
ms.custom: intro-overview
---
# C/C++ projects and build systems in Visual Studio

Expand Down
4 changes: 2 additions & 2 deletions docs/build/reference/zc-inline-remove-unreferenced-comdat.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ By default, this option is off (**/Zc:inline-**) in command-line builds. The [/p

If **/Zc:inline** is specified, the compiler enforces the C++11 requirement that all functions declared **`inline`** must have a definition available in the same translation unit if they are used. When the option is not specified, the Microsoft compiler allows non-conformant code that invokes functions declared **`inline`** even if no definition is visible. For more information, see the C++11 standard, in section 3.2 and section 7.1.2. This compiler option was introduced in Visual Studio 2013 Update 2.

To use the **/Zc:inline** option, update non-compliant code.
To use the **/Zc:inline** option, update non-conforming code.

This example shows how the non-compliant use of an inline function declaration without a definition still compiles and links when the default **/Zc:inline-** option is used:
This example shows how the non-conforming use of an inline function declaration without a definition still compiles and links when the default **/Zc:inline-** option is used:

```cpp
// example.h
Expand Down
2 changes: 1 addition & 1 deletion docs/build/vscpp-step-0-installation.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Install C and C++ support in Visual Studio
description: "Learn how to install Visual Studio with support for Microsoft C/C++ and related workloads."
ms.custom: "vs-acquisition"
ms.custom: vs-acquisition, intro-installation
ms.date: 11/05/2020
ms.topic: "tutorial"
ms.devlang: "cpp"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ You can use NMAKE and makefiles, or MSBuild and project files to configure and b

The C and C++ languages are similar, but not the same. The Microsoft C/C++ compiler (MSVC) uses a basic rule to determine which language to use when it compiles your code. By default, the MSVC compiler treats all files that end in *`.c`* as C source code, and all files that end in *`.cpp`* as C++ source code. To force the compiler to treat all files as C no matter the file name extension, use the [/TC](reference/tc-tp-tc-tp-specify-source-file-type.md) compiler option.

MSVC is compatible with the ANSI C89 and ISO C99 standards, but not strictly compliant. In most cases, portable C code will compile and run as expected. The compiler provides optional support for the changes in ISO C11/C17. To compile with C11/C17 support, use the compiler flag **`/std:c11`** or **`/std:c17`**. C11/C17 support requires Windows SDK 10.0.20201.0 or later. Windows SDK 10.0.20348.0 (version 2104) or later is recommended. You can download the latest SDK from the [Windows 10 SDK](https://developer.microsoft.com/windows/downloads/windows-10-sdk/) page. For more information, and instructions on how to install and use this SDK for C development, see [Install C11 and C17 support in Visual Studio](../overview/install-c17-support.md).
MSVC is compatible with the ANSI C89 and ISO C99 standards, but not strictly conforming. In most cases, portable C code will compile and run as expected. The compiler provides optional support for the changes in ISO C11/C17. To compile with C11/C17 support, use the compiler flag **`/std:c11`** or **`/std:c17`**. C11/C17 support requires Windows SDK 10.0.20201.0 or later. Windows SDK 10.0.20348.0 (version 2104) or later is recommended. You can download the latest SDK from the [Windows 10 SDK](https://developer.microsoft.com/windows/downloads/windows-10-sdk/) page. For more information, and instructions on how to install and use this SDK for C development, see [Install C11 and C17 support in Visual Studio](../overview/install-c17-support.md).

Certain library functions and POSIX function names are deprecated by MSVC. The functions are supported, but the preferred names have changed. For more information, see [Security Features in the CRT](../c-runtime-library/security-features-in-the-crt.md) and [Compiler Warning (level 3) C4996](../error-messages/compiler-warnings/compiler-warning-level-3-c4996.md).

Expand Down
2 changes: 1 addition & 1 deletion docs/c-language/c-keywords.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ The following keywords and special identifiers are recognized by the Microsoft C

Microsoft extensions are enabled by default. To assist in creating portable code, you can disable Microsoft extensions by specifying the [/Za \(Disable language extensions)](../build/reference/za-ze-disable-language-extensions.md) option during compilation. When you use this option, some Microsoft-specific keywords are disabled.

When Microsoft extensions are enabled, you can use the keywords listed above in your programs. For standards compliance, most of these keywords are prefaced by a double underscore. The four exceptions, **`dllexport`**, **`dllimport`**, **`naked`**, and **`thread`**, are used only with **`__declspec`** and don't require a leading double underscore. For backward compatibility, single-underscore versions of the rest of the keywords are supported.
When Microsoft extensions are enabled, you can use the keywords listed above in your programs. To conform to the language standard, most of these keywords are prefaced by a double underscore. The four exceptions, **`dllexport`**, **`dllimport`**, **`naked`**, and **`thread`**, are used only with **`__declspec`** and don't require a leading double underscore. For backward compatibility, single-underscore versions of the rest of the keywords are supported.

## See also

Expand Down
2 changes: 1 addition & 1 deletion docs/c-language/c-type-specifiers.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ The keyword **`void`** has three uses: to specify a function return type, to spe

**Microsoft Specific**

Type checking is now ANSI-compliant, which means that type **`short`** and type **`int`** are distinct types. For example, this is a redefinition in the Microsoft C compiler that was accepted by previous versions of the compiler.
Type checking is now ANSI-conforming, which means that type **`short`** and type **`int`** are distinct types. For example, this is a redefinition in the Microsoft C compiler that was accepted by previous versions of the compiler.

```C
int myfunc();
Expand Down
10 changes: 5 additions & 5 deletions docs/c-language/function-prototypes.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,27 @@ The prototype has the same form as the function definition, except that it is te

Function prototypes have the following important uses:

- They establish the return type for functions that return types other than **`int`**. Although functions that return **`int`** values do not require prototypes, prototypes are recommended.
- They establish the return type for functions that return types other than **`int`**. Although functions that return **`int`** values don't require prototypes, prototypes are recommended.

- Without complete prototypes, standard conversions are made, but no attempt is made to check the type or number of arguments with the number of parameters.

- Prototypes are used to initialize pointers to functions before those functions are defined.

- The parameter list is used for checking the correspondence of arguments in the function call with the parameters in the function definition.
- The parameter list is used to check that arguments in the function call match the parameters in the function definition.

The converted type of each parameter determines the interpretation of the arguments that the function call places on the stack. A type mismatch between an argument and a parameter may cause the arguments on the stack to be misinterpreted. For example, on a 16-bit computer, if a 16-bit pointer is passed as an argument, then declared as a **`long`** parameter, the first 32 bits on the stack are interpreted as a **`long`** parameter. This error creates problems not only with the **`long`** parameter, but with any parameters that follow it. You can detect errors of this kind by declaring complete function prototypes for all functions.

A prototype establishes the attributes of a function so that calls to the function that precede its definition (or occur in other source files) can be checked for argument-type and return-type mismatches. For example, if you specify the **`static`** storage-class specifier in a prototype, you must also specify the **`static`** storage class in the function definition.
A prototype establishes the attributes of a function. Then, function calls that precede the function definition (or that occur in other source files) can be checked for argument-type and return-type mismatches. For example, if you specify the **`static`** storage-class specifier in a prototype, you must also specify the **`static`** storage class in the function definition.

Complete parameter declarations (`int a`) can be mixed with abstract declarators (**`int`**) in the same declaration. For example, the following declaration is legal:

```C
int add( int a, int );
```

The prototype can include both the type of, and an identifier for, each expression that is passed as an argument. However, such identifiers have scope only until the end of the declaration. The prototype can also reflect the fact that the number of arguments is variable, or that no arguments are passed. Without such a list, mismatches may not be revealed, so the compiler cannot generate diagnostic messages concerning them. See [Arguments](../c-language/arguments.md) for more information on type checking.
The prototype can include both the type of, and an identifier for, each expression that's passed as an argument. However, such identifiers are only in scope until the end of the declaration. The prototype can also reflect the fact that the number of arguments is variable, or that no arguments are passed. Without such a list, mismatches may not be revealed, so the compiler can't generate diagnostic messages concerning them. For more information on type checking, see [Arguments](../c-language/arguments.md).

Prototype scope in the Microsoft C compiler is now ANSI-compliant when compiling with the **/Za** compiler option. This means that if you declare a **`struct`** or **`union`** tag within a prototype, the tag is entered at that scope rather than at global scope. For example, when compiling with **/Za** for ANSI compliance, you can never call this function without getting a type mismatch error:
Prototype scope in the Microsoft C compiler is now ANSI-conforming when compiling with the **`/Za`** compiler option. If you declare a **`struct`** or **`union`** tag within a prototype, the tag is entered at that scope rather than at global scope. For example, when compiling with **`/Za`** for ANSI conformance, you can never call this function without getting a type mismatch error:

```C
void func1( struct S * );
Expand Down
1 change: 1 addition & 0 deletions docs/c-language/index.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ metadata:
description: C programming reference for users of Microsoft C/C++ and Visual Studio.
ms.topic: landing-page
ms.date: 05/28/2020
ms.custom: intro-landing-hub

# linkListType: architecture | concept | deploy | download | get-started | how-to-guide | learn | overview | quickstart | reference | tutorial | video | whats-new

Expand Down
Loading