Skip to content

Commit 75b7f06

Browse files
committed
acrolinx
1 parent 803b212 commit 75b7f06

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

docs/code-quality/c26838.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
# For valid values of ms.service, ms.prod, and ms.topic, see https://review.learn.microsoft.com/en-us/help/platform/metadata-taxonomies?branch=main
55

66
title: Warning C26838
7-
description: Learn about Microsoft C++ code analysis warning. C26838
7+
description: Learn about Microsoft C++ code analysis warning C26838.
88
author: Rastaban
99
ms.author: philc
1010
ms.topic: reference
@@ -29,7 +29,7 @@ int* CreateIntArray(int numberOfElements)
2929
}
3030
```
3131
32-
In the expression `numberOfElements * sizeof(int)`, `numberOfElements` is signed and `sizeof(int)` is unsigned. On 64 bit machines `numberOfElements` will be promoted to an unsigned value when multiplied
32+
In the expression `numberOfElements * sizeof(int)`, `numberOfElements` is signed and `sizeof(int)` is unsigned. On 64-bit machines, `numberOfElements` is promoted to an unsigned value when multiplied
3333
by `sizeof(int)`. When `numberOfElements` is negative, the resulting value may overflow or have unexpected results when passed to `CustomAlloc`.
3434
3535
This check applies to common allocation functions like `new`, `malloc`, and `VirtualAlloc`. The check also applies to custom allocator functions that have `alloc` (case insensitive) in the function name.
@@ -57,7 +57,7 @@ int* CreateIntArray(int numberOfElements)
5757
```
5858

5959
In the previous example, checking for a negative value addresses the C26832 warning. Depending on the size of the types involved, this check may result in a different warning such as [`C26831`](c26831.md).
60-
For example, on a 32 bit system, both `int` and `size_t` are 32 bits, so the result of the multiplication can still overflow without negative values.
60+
For example, on a 32-bit system, both `int` and `size_t` are 32 bits, so the result of the multiplication can still overflow without negative values.
6161

6262
## See also
6363

docs/code-quality/c26839.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ ms.date: 1/10/2025
1616
1717
## Remarks
1818

19-
This warning reports that the size specified for a array new allocation may be the result of the conversion of a possibly negative signed value to an unsigned value. For example:
19+
This warning reports that the size specified for an array new allocation may be the result of the conversion of a possibly negative signed value to an unsigned value. For example:
2020

2121
```cpp
2222
int* CreateIntArray(int size)
@@ -26,7 +26,7 @@ int* CreateIntArray(int size)
2626
}
2727
```
2828
29-
In the expression `new int[size]`, `size` is signed. The compiler will convert the signed value to an unsigned value when calculating how many bytes need to be allocated for the array.
29+
In the expression `new int[size]`, `size` is signed. The compiler converts the signed value to an unsigned value to calculate how many bytes need to be allocated for the array.
3030
When `size` is negative, the result of that calculation may overflow or have unexpected results.
3131
3232
This check is the same as [`C26838`](c26838.md), but applies only to array new `new T[]`.

0 commit comments

Comments
 (0)