Skip to content

Commit acb77ae

Browse files
committed
Merge branch 'main' of https://github.com/MicrosoftDocs/cpp-docs-pr into patricka-azure-sdk
2 parents 6eb504c + eceaf6f commit acb77ae

File tree

50 files changed

+586
-230
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+586
-230
lines changed

docs/code-quality/c26865.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
---
2+
description: "Learn more about: Warning C26865"
3+
title: Warning C26865
4+
ms.date: 10/03/2022
5+
f1_keywords: ["C26865", "ALLOCATION_DEALLOCATION_MISMATCH", "__WARNING_ALLOCATION_DEALLOCATION_MISMATCH"]
6+
helpviewer_keywords: ["C26865"]
7+
ms.assetid: 2fbe9dc5-fa43-47b9-97a7-3f8215da1d40
8+
---
9+
# Warning C26865
10+
11+
> Memory allocated with '\<allocation-function\>' is being deallocated with '\<wrong-deallocation-function\>'. Use '\<correct-deallocation-function\>' instead.
12+
13+
This rule was added in Visual Studio 2026 18.0.
14+
15+
## Remarks
16+
17+
This warning indicates that the memory was allocated with one family of allocation functions, but was freed with a deallocation function from a different family. This usage results in undefined behavior according to C/C++ and the Microsoft MSVC implementation.
18+
19+
The exact ramifications of this defect are difficult to predict. It might result in leaks for classes with destructors that perform memory deallocation. It could cause inconsistent behavior for classes with destructors that perform semantically significant operations, or memory corruptions and crashes. In other cases the mismatch might be unimportant, depending on the implementation of the compiler and its libraries. Analysis tools can't always distinguish between these situations.
20+
21+
If memory is allocated with one family of allocation functions, it should be freed with a matching deallocation function.
22+
23+
C26865 covers the following allocation/deallocation pairs:
24+
25+
- C++ scalar new (`new`) must be deallocated with scalar delete (`delete`).
26+
- C++ array new (`new[]`) must be deallocated with array delete (`delete[]`).
27+
- C/C++ `malloc`/`calloc`/`realloc` must be deallocated with `free` (or `realloc`).
28+
- Windows `HeapAlloc` must be deallocated with `HeapFree`.
29+
- Windows `GlobalAlloc` must be deallocated with `GlobalFree`.
30+
- Windows `LocalAlloc` must be deallocated with `LocalFree`.
31+
- Windows `MIDL_user_allocate` must be deallocated with `MIDL_user_free`.
32+
- Component Object Model (COM) `CoTaskMemAlloc` must be deallocated with `CoTaskMemFree`.
33+
34+
Code analysis name: `ALLOCATION_DEALLOCATION_MISMATCH`
35+
36+
## Example
37+
38+
The following sample code generates warning C26865:
39+
40+
```cpp
41+
void f() {
42+
int *pInt = (int *)calloc(10, sizeof(int));
43+
// code ...
44+
delete pInt; // C26865: Memory allocated with 'calloc' is being deallocated with 'delete'. Use 'free' instead.
45+
}
46+
47+
void g() {
48+
char * str = new char[50];
49+
// code ...
50+
delete str; // C26865: Memory allocated with 'new[]' is being deallocated with 'delete'. Use 'delete[]' instead.
51+
}
52+
```
53+
54+
Manual memory management has many pitfalls in terms of memory leaks and exceptions. To avoid these kinds of potential leaks altogether, use the mechanisms that are provided by the C++ Standard Library (STL). These mechanisms include [`shared_ptr`](../standard-library/shared-ptr-class.md), [`unique_ptr`](../standard-library/unique-ptr-class.md), and containers such as [`vector`](../standard-library/vector.md). For more information, see [Smart pointers](../cpp/smart-pointers-modern-cpp.md) and [C++ Standard Library](../standard-library/cpp-standard-library-reference.md).

docs/code-quality/c6278.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,10 @@ helpviewer_keywords: ["C6278"]
99

1010
> '*variable*' is allocated with array new [], but deleted with scalar delete. Destructors will not be called.
1111
12+
## Notice
13+
14+
Warning C6278 was removed in Visual Studio 2026. Use the more generic warning [`C26865`](../code-quality/C26865.md) instead.
15+
1216
## Remarks
1317

1418
This warning appears only in C++ code and indicates that the calling function has inconsistently allocated memory with the array **`new []`** operator, but freed it with the scalar **`delete`** operator. This usage is undefined behavior according to the C++ standard and the Microsoft C++ implementation.

docs/code-quality/c6279.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ helpviewer_keywords: ["C6279"]
99

1010
> '*variable-name*' is allocated with scalar new, deleted with array delete []
1111
12+
This warning appears only in C++ code and indicates that the calling function has inconsistently allocated memory with the scalar `new` operator, but freed it with the array `delete[]` operator. If memory is allocated with scalar `new`, it should typically be freed with scalar `delete`.
13+
14+
## Notice
15+
16+
Warning C6279 was removed in Visual Studio 2026. Use the more generic warning [`C26865`](../code-quality/C26865.md) instead.
17+
1218
## Remarks
1319

1420
This warning appears only in C++ code and indicates that the calling function has inconsistently allocated memory with the scalar `new` operator, but freed it with the array `delete[]` operator. If memory is allocated with scalar `new`, it should typically be freed with scalar `delete`.

docs/code-quality/c6280.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ helpviewer_keywords: ["C6280"]
99

1010
> '*variable-name*' is allocated with '*function-name-1*', but deleted with '*function-name-2*'
1111
12+
This warning indicates that the calling function has inconsistently allocated memory by using a function from one family and freed it by using a function from another.
13+
14+
## Notice
15+
16+
Warning C6280 was removed in Visual Studio 2026. Use the more generic warning [`C26865`](../code-quality/C26865.md) instead.
17+
1218
## Remarks
1319

1420
This warning indicates that the calling function has inconsistently allocated memory by using a function from one family and freed it by using a function from another.

docs/code-quality/c6283.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,12 @@ helpviewer_keywords: ["C6283"]
99

1010
> '*variable-name*' is allocated with array new [], but deleted with scalar delete
1111
12+
This warning appears only in C++ code and indicates that the calling function has inconsistently allocated memory with the array `new []` operator, but freed it with the scalar `delete` operator.
13+
14+
## Notice
15+
16+
Warning C6283 was removed in Visual Studio 2026. Use the more generic warning [`C26865`](../code-quality/C26865.md) instead.
17+
1218
## Remarks
1319

1420
This warning appears only in C++ code and indicates that the calling function has inconsistently allocated memory with the array `new []` operator, but freed it with the scalar `delete` operator.

docs/code-quality/toc.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,8 @@ items:
661661
href: ../code-quality/c26863.md
662662
- name: Warning C26864
663663
href: ../code-quality/c26864.md
664+
- name: Warning C26865
665+
href: ../code-quality/c26865.md
664666
- name: Warning C28020
665667
href: ../code-quality/c28020.md
666668
- name: Warning C28021

docs/cross-platform/build-an-opengl-es-application-on-android-and-ios.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ ms.custom: sfi-image-nochange
88

99
# Build an OpenGL ES application on Android and iOS
1010

11+
> [!IMPORTANT]
12+
> Starting with Visual Studio 2026 (version 18.0), the Mobile development with C++ workload for iOS and Android, as well as the Embedded and IoT tools (RTOS Viewer, Serial Monitor, Peripheral Viewer, and ST Project Import), are no longer supported and will be removed in a future update. The Android NDKs included in the Mobile development with C++ workload remain supported.
13+
> OpenGL support is no longer available. It was last available in Visual Studio 17.3.
14+
1115
You can create Visual Studio solutions and projects for iOS apps and Android apps that share common code. This article guides you through a combined solution template. It creates both an iOS app, and an Android Native Activity app. The apps have C++ code in common that uses OpenGL ES to display the same animated rotating cube on each platform. OpenGL ES (OpenGL for Embedded Systems or GLES) is a 2D and 3D graphics API. It's supported on many mobile devices.
1216

1317
## Requirements
1418

15-
> [!IMPORTANT]
16-
> OpenGL support is no longer available. It was last available in Visual Studio 17.3.
17-
1819
Here are the system requirements to create an OpenGL ES app for iOS and Android. If you haven't already, install the Mobile Development with C++ workload in the Visual Studio Installer. To get the OpenGL ES templates, and to build for iOS, include the optional C++ iOS development tools. To build for Android, install the C++ Android development tools and the required third-party tools: Android NDK, Apache Ant, and Google Android Emulator.
1920

2021
For better emulator performance on Intel platforms, one option is to install the Intel Hardware Accelerated Execution Manager (HAXM). For detailed instructions, see [Install cross-platform mobile development with C++](../cross-platform/install-visual-cpp-for-cross-platform-mobile-development.md).

docs/cross-platform/create-an-android-native-activity-app.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,13 @@
22
description: "Learn more about: Create an Android Native Activity App"
33
title: "Create an Android Native Activity App"
44
ms.date: "10/17/2019"
5-
ms.assetid: 884014b1-5208-45ec-b0da-ad0070d2c24d
65
ms.topic: how-to
76
---
87
# Create an Android Native Activity App
98

9+
> [!IMPORTANT]
10+
> Starting with Visual Studio 2026 (version 18.0), the Mobile development with C++ workload for iOS and Android, as well as the Embedded and IoT tools (RTOS Viewer, Serial Monitor, Peripheral Viewer, and ST Project Import), are no longer supported and will be removed in a future update. The Android NDKs included in the Mobile development with C++ workload remain supported.
11+
1012
When you install the cross-platform **Mobile development with C++** workload, Visual Studio can be used to create fully functional Android Native Activity apps. The Android Native Development Kit (NDK) is a toolset that allows you to implement the majority of your Android app using pure C/C++ code. Some Java JNI code acts as glue to allow your C/C++ code to interact with Android. The Android NDK introduced the ability to create Native Activity apps with Android API Level 9. Native Activity code is popular for creating gaming and graphic intensive apps that use Unreal Engine or OpenGL. This topic will guide you through creation of a simple Native Activity app that uses OpenGL. Additional topics walk through the developer lifecycle of editing, building, debugging and deploying Native Activity code.
1113

1214
## Requirements

docs/cross-platform/cross-platform-mobile-development-examples.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ ms.date: 03/04/2024
55
---
66
# Cross-platform mobile development examples
77

8+
> [!IMPORTANT]
9+
> Starting with Visual Studio 2026 (version 18.0), the Mobile development with C++ workload for iOS and Android, as well as the Embedded and IoT tools (RTOS Viewer, Serial Monitor, Peripheral Viewer, and ST Project Import), are no longer supported and will be removed in a future update. The Android NDKs included in the Mobile development with C++ workload remain supported.
10+
811
Several of the templates installed by the **Mobile development with C++** workload generate complete examples that you can use to learn from. Additionally, here are some example applications that you can download and try out in Visual Studio.
912

1013
- [hello-jni Android Application Sample](https://github.com/android/ndk-samples/tree/master/hello-jni)

docs/cross-platform/general-android-prop-page.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
description: "Learn more about: General Project Properties (Android C++)"
33
title: "General Project Properties (Android C++)"
44
ms.date: "10/23/2017"
5-
ms.assetid: 65f4868b-b864-4989-a275-1e51869ef599
65
f1_keywords:
76
- VC.Project.VCConfiguration.Android.OutputDirectory
87
- VC.Project.VCConfiguration.Android.IntermediateDirectory
@@ -17,6 +16,9 @@ f1_keywords:
1716
---
1817
# General Project Properties (Android C++)
1918

19+
> [!IMPORTANT]
20+
> Starting with Visual Studio 2026 (version 18.0), the Mobile development with C++ workload for iOS and Android, as well as the Embedded and IoT tools (RTOS Viewer, Serial Monitor, Peripheral Viewer, and ST Project Import), are no longer supported and will be removed in a future update. The Android NDKs included in the Mobile development with C++ workload remain supported.
21+
2022
| Property | Description | Choices |
2123
|--|--|--|
2224
| Output Directory | Specifies a relative path to the output file directory; can include environment variables. |

0 commit comments

Comments
 (0)