Skip to content

Commit cb369b6

Browse files
authored
Merge pull request #5746 from Rageking8/structure-warning-references-in-range-c6251-c6310
Structure warning references in range [C6251, C6310]
2 parents f31bfbb + 0875800 commit cb369b6

Some content is hidden

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

43 files changed

+88
-117
lines changed

docs/code-quality/c6255.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
---
2+
title: "Warning C6255"
23
description: "Learn more about: Warning C6255"
3-
title: Warning C6255
44
ms.date: 11/04/2016
55
f1_keywords: ["C6255", "UNPROTECTEDUSEOFALLOCA", "__WARNING_UNPROTECTEDUSEOFALLOCA"]
66
helpviewer_keywords: ["C6255"]
7-
ms.assetid: bb6430b2-782a-4410-a8e1-609df06007de
87
---
98
# Warning C6255
109

1110
> _alloca indicates failure by raising a stack overflow exception. Consider using _malloca instead
1211
13-
This warning indicates that a call to `_alloca` has been detected outside of local exception handling.
14-
1512
## Remarks
1613

14+
This warning indicates that a call to `_alloca` has been detected outside of local exception handling.
15+
1716
`_alloca` should always be called from within the protected range of an exception handler because it can raise a stack overflow exception on failure. If possible, instead of using `_alloca`, consider using `_malloca`, which is a more secure version of `_alloca`.
1817

1918
Code analysis name: `UNPROTECTEDUSEOFALLOCA`

docs/code-quality/c6258.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
---
2+
title: "Warning C6258"
23
description: "Learn more about: Warning C6258"
3-
title: Warning C6258
44
ms.date: 11/04/2016
55
f1_keywords: ["C6258", "USINGTERMINATETHREAD", "__WARNING_USINGTERMINATETHREAD"]
66
helpviewer_keywords: ["C6258"]
7-
ms.assetid: 62f3eed7-d9cd-46eb-8c38-0bc4f647941f
87
---
98
# Warning C6258
109

1110
> Using `TerminateThread` does not allow proper thread clean up.
1211
13-
This warning indicates that a call to `TerminateThread` has been detected.
14-
1512
## Remarks
1613

14+
This warning indicates that a call to `TerminateThread` has been detected.
15+
1716
`TerminateThread` is a dangerous function that should only be used in the most extreme cases. For more information about problems associated with TerminateThread call, see [`TerminateThread` function](/windows/desktop/api/processthreadsapi/nf-processthreadsapi-terminatethread).
1817

1918
Code analysis name: `USINGTERMINATETHREAD`

docs/code-quality/c6259.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2+
title: "Warning C6259"
23
description: "Learn more about: Warning C6259"
3-
title: Warning C6259
44
ms.date: 11/04/2016
55
f1_keywords: ["C6259", "DEADCODEINBITORLIMITEDSWITCH", "__WARNING_DEADCODEINBITORLIMITEDSWITCH"]
66
helpviewer_keywords: ["C6259"]
7-
ms.assetid: a370bfd2-6634-402c-84c7-3d83fa0009b7
87
---
98
# Warning C6259
109

@@ -18,7 +17,7 @@ Code analysis name: `DEADCODEINBITORLIMITEDSWITCH`
1817

1918
## Example
2019

21-
The following sample code generates this warning because the 'switch' expression `(rand() & 3)` can't evaluate to case label (`case 4`):
20+
The following example code generates this warning because the 'switch' expression `(rand() & 3)` can't evaluate to case label (`case 4`):
2221

2322
```cpp
2423
#include <stdlib.h>

docs/code-quality/c6260.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
---
2+
title: "Warning C6260"
23
description: "Learn more about: Warning C6260"
3-
title: Warning C6260
44
ms.date: 11/04/2016
55
f1_keywords: ["C6260", "USEOFBYTEAREA", "__WARNING_USEOFBYTEAREA"]
66
helpviewer_keywords: ["C6260"]
7-
ms.assetid: 9cbedfcb-32b2-4fe4-99f7-a2d4a7f4422a
87
---
98
# Warning C6260
109

1110
> `sizeof` * `sizeof` is almost always wrong, did you intend to use a character count or a byte count?
1211
13-
This warning indicates that the results of two **`sizeof`** operations have been multiplied together.
14-
1512
## Remarks
1613

14+
This warning indicates that the results of two **`sizeof`** operations have been multiplied together.
15+
1716
The C/C++ **`sizeof`** operator returns the number of bytes of storage an object uses. It's typically incorrect to multiply it by another **`sizeof`** operation. Usually, you're interested in the number of bytes in an object or the number of elements in an array (for example, the number of wide-characters in an array).
1817

1918
There's some unintuitive behavior associated with **`sizeof`** operator. For example, in C, `sizeof ('\0') == 4`, because a character is of an integral type. In C++, the type of a character literal is **`char`**, so `sizeof ('\0') == 1`. However, in both C and C++, the following relation is true:

docs/code-quality/c6262.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
---
2-
title: Warning C6262
2+
title: "Warning C6262"
33
description: "Visual Studio C++ Code Analysis warning C6262 description and resolution."
44
ms.date: 10/14/2020
55
f1_keywords: ["C6262", "EXCESSIVESTACKUSAGE", "__WARNING_EXCESSIVESTACKUSAGE"]

docs/code-quality/c6263.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2+
title: "Warning C6263"
23
description: "Learn more about: Warning C6263"
3-
title: Warning C6263
44
ms.date: 11/04/2016
55
f1_keywords: ["C6263", "USINGALLOCAINLOOP", "__WARNING_USINGALLOCAINLOOP"]
66
helpviewer_keywords: ["C6263"]
7-
ms.assetid: bc360ad7-5f59-4480-a642-6c7e6beeb5f6
87
---
98
# Warning C6263
109

docs/code-quality/c6268.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
---
2+
title: "Warning C6268"
23
description: "Learn more about: Warning C6268"
3-
title: Warning C6268
44
ms.date: 11/04/2016
55
f1_keywords: ["C6268", "MISPARENTHESIZED_CASTS", "__WARNING_MISPARENTHESIZED_CASTS"]
66
helpviewer_keywords: ["C6268"]
7-
ms.assetid: fd81e00a-de2f-498b-b3fe-53ce056042d7
87
---
98
# Warning C6268
109

1110
> Incorrect order of operations: ('*TYPE1*')('*TYPE2*')x + y. Possible missing parentheses in ('*TYPE1*')(('*TYPE2*')x + y)
1211
13-
This warning indicates that a complex cast expression might involve a precedence problem when performing pointer arithmetic. Because casts group more closely than binary operators, the result might not be what the programmer intended. In some cases, this defect causes incorrect behavior or a program crash.
14-
1512
## Remarks
1613

14+
This warning indicates that a complex cast expression might involve a precedence problem when performing pointer arithmetic. Because casts group more closely than binary operators, the result might not be what the programmer intended. In some cases, this defect causes incorrect behavior or a program crash.
15+
1716
In an expression such as:
1817

1918
```cpp

docs/code-quality/c6269.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,18 @@
11
---
2+
title: "Warning C6269"
23
description: "Learn more about: Warning C6269"
3-
title: Warning C6269
44
ms.date: 11/04/2016
55
f1_keywords: ["C6269", "POINTER_DEREF_DISCARDED", "__WARNING_POINTER_DEREF_DISCARDED"]
66
helpviewer_keywords: ["C6269"]
7-
ms.assetid: a01fa7fa-fc6c-4af7-ac8c-585e44e60cca
87
---
98
# Warning C6269
109

1110
> Possible incorrect order of operations: dereference ignored
1211
13-
This warning indicates that the result of a pointer dereference is being ignored, which raises the question of why the pointer is being dereferenced in the first place.
14-
1512
## Remarks
1613

14+
This warning indicates that the result of a pointer dereference is being ignored, which raises the question of why the pointer is being dereferenced in the first place.
15+
1716
The compiler will correctly optimize away the gratuitous dereference. In some cases, however, this defect may reflect a precedence or logic error.
1817

1918
One common cause for this defect is an expression statement of the form:

docs/code-quality/c6270.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2+
title: "Warning C6270"
23
description: "Learn more about: Warning C6270"
3-
title: Warning C6270
44
ms.date: 3/03/2023
55
f1_keywords: ["C6270", "MISSING_FLOAT_ARGUMENT_TO_FORMAT_FUNCTION", "__WARNING_MISSING_FLOAT_ARGUMENT_TO_FORMAT_FUNCTION"]
66
helpviewer_keywords: ["C6270"]

docs/code-quality/c6271.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
2+
title: "Warning C6271"
23
description: "Learn more about: Warning C6271"
3-
title: Warning C6271
44
ms.date: 3/06/2023
55
f1_keywords: ["C6271", "EXTRA_ARGUMENT_TO_FORMAT_FUNCTION", "__WARNING_EXTRA_ARGUMENT_TO_FORMAT_FUNCTION"]
66
helpviewer_keywords: ["C6271"]
@@ -17,7 +17,7 @@ Code analysis name: `EXTRA_ARGUMENT_TO_FORMAT_FUNCTION`
1717

1818
## Example
1919

20-
The following sample code generates this warning:
20+
The following example code generates this warning:
2121

2222
```cpp
2323
#include <stdio.h>
@@ -43,7 +43,7 @@ void f()
4343
}
4444
```
4545

46-
The following sample code calls the safe string manipulation function, `sprintf_s`, to correct this warning:
46+
The following example code calls the safe string manipulation function, `sprintf_s`, to correct this warning:
4747

4848
```cpp
4949
#include <stdio.h>

0 commit comments

Comments
 (0)