Skip to content

Commit 5998fa3

Browse files
authored
Merge pull request #5719 from Rageking8/structure-warning-references-in-range-c4311-c4360
Structure warning references in range [C4311, C4360]
2 parents edfbba4 + f5607c8 commit 5998fa3

26 files changed

Lines changed: 178 additions & 109 deletions

docs/error-messages/compiler-warnings/compiler-warning-c4355.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,17 @@ helpviewer_keywords: ["C4355"]
99

1010
> '`this`': used in base member initializer list
1111
12+
## Remarks
13+
1214
The `this` pointer is valid only within nonstatic member functions. It can't be used in the initializer list for a base class.
1315

1416
The base-class constructors and class member constructors are called before `this` constructor. This pattern is the same as passing a pointer to an unconstructed object to another constructor. If those other constructors access any members or call member functions on `this`, the result is undefined. You shouldn't use the `this` pointer until all construction is complete.
1517

1618
This warning is off by default. For more information, see [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md).
1719

18-
The following sample generates C4355:
20+
## Example
21+
22+
The following example generates C4355:
1923

2024
```cpp
2125
// C4355.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4311.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,22 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4311"
32
title: "Compiler Warning (level 1) C4311"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Warning (level 1) C4311"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C4311"]
66
helpviewer_keywords: ["C4311"]
7-
ms.assetid: ddc579d0-d051-47bc-915d-71ffb32323c9
87
---
98
# Compiler Warning (level 1) C4311
109

11-
'variable' : pointer truncation from 'type' to 'type'
10+
> 'variable' : pointer truncation from 'type' to 'type'
11+
12+
## Remarks
1213

1314
This warning detects 64-bit pointer truncation issues. For example, if code is compiled for a 64-bit architecture, the value of a pointer (64 bits) will be truncated if it is assigned to an **`int`** (32 bits). For more information, see [Rules for Using Pointers](/windows/win32/WinProg64/rules-for-using-pointers).
1415

1516
For additional information about common causes of warning C4311, see [Common Compiler Errors](/windows/win32/WinProg64/common-compiler-errors).
1617

18+
## Example
19+
1720
The following code example generates C4311 when compiled for a 64-bit target, and then demonstrates how to fix it:
1821

1922
```cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4312.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4312"
32
title: "Compiler Warning (level 1) C4312"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Warning (level 1) C4312"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C4312"]
66
helpviewer_keywords: ["C4312"]
7-
ms.assetid: 541906ed-4f62-4bcb-947f-cf9ae7411bcb
87
---
98
# Compiler Warning (level 1) C4312
109

11-
'operation' : conversion from 'type1' to 'type2' of greater size
10+
> 'operation' : conversion from 'type1' to 'type2' of greater size
11+
12+
## Remarks
1213

1314
This warning detects an attempt to assign a 32-bit value to a 64-bit pointer type, for example, casting a 32-bit **`int`** or **`long`** to a 64-bit pointer.
1415

1516
This can be an unsafe conversion even for pointer values that fit in 32 bits when sign extension occurs. If a negative 32-bit integer is assigned to a 64-bit pointer type, sign extension causes the pointer value to reference a memory address different from the value of the integer.
1617

1718
This warning is only issued for 64-bit compilation targets. For more information, see [Rules for Using Pointers](/windows/win32/WinProg64/rules-for-using-pointers).
1819

20+
## Example
21+
1922
The following code example generates C4312 when it is compiled for 64-bit targets:
2023

2124
```cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4313.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4313"
32
title: "Compiler Warning (level 1) C4313"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Warning (level 1) C4313"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C4313"]
66
helpviewer_keywords: ["C4313"]
7-
ms.assetid: bcf64191-e2cf-452e-97b4-423fcec2d07c
87
---
98
# Compiler Warning (level 1) C4313
109

11-
'function' : 'format specifier' in format string conflicts with argument number of type 'type'
10+
> 'function' : 'format specifier' in format string conflicts with argument number of type 'type'
11+
12+
## Remarks
1213

1314
There is a conflict between the format specified and the value that you are passing. For example, you passed a 64-bit parameter to an unqualified %d format specifier, which expects a 32-bit integer parameter. This warning is only in effect when the code is compiled for 64-bit targets.
1415

1516
## Example
1617

17-
The following code sample generates C4313 when it is compiled for a 64-bit target.
18+
The following code example generates C4313 when it is compiled for a 64-bit target.
1819

1920
```cpp
2021
// C4313.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4319.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4319"
32
title: "Compiler Warning (level 1) C4319"
4-
ms.date: "01/18/2018"
3+
description: "Learn more about: Compiler Warning (level 1) C4319"
4+
ms.date: 01/18/2018
55
f1_keywords: ["C4319"]
66
helpviewer_keywords: ["C4319"]
7-
ms.assetid: 1fac8048-9bd6-4552-a21c-192c67772bb9
87
---
98
# Compiler Warning (level 1) C4319
109

1110
> '~' : zero extending '*type1*' to '*type2*' of greater size
1211
12+
## Remarks
13+
1314
The result of the **~** (bitwise complement) operator is unsigned and then zero-extended when it is converted to a larger type.
1415

1516
## Example

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4325.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4325"
32
title: "Compiler Warning (level 1) C4325"
4-
ms.date: "08/27/2018"
3+
description: "Learn more about: Compiler Warning (level 1) C4325"
4+
ms.date: 08/27/2018
55
f1_keywords: ["C4325"]
66
helpviewer_keywords: ["C4325"]
7-
ms.assetid: 8127a08c-d626-481b-aa7b-04a3fdc9a9ec
87
---
98
# Compiler Warning (level 1) C4325
109

1110
> attributes for standard section '*section*' ignored
1211
1312
## Remarks
1413

15-
You may not change the attributes of a standard section. For example:
14+
You may not change the attributes of a standard section.
15+
16+
## Example
17+
18+
For example:
1619

1720
```cpp
1821
#pragma section(".sdata", long)

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4326.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4326"
32
title: "Compiler Warning (level 1) C4326"
4-
ms.date: "08/27/2018"
3+
description: "Learn more about: Compiler Warning (level 1) C4326"
4+
ms.date: 08/27/2018
55
f1_keywords: ["C4326"]
66
helpviewer_keywords: ["C4326"]
7-
ms.assetid: d44d2c4e-9456-42d3-b35b-4ba4b2d42ec7
87
---
98
# Compiler Warning (level 1) C4326
109

@@ -16,7 +15,7 @@ A function returned a type other than *type1*. For example, using [/Za](../../bu
1615

1716
## Example
1817

19-
The following sample generates C4326 and shows how to fix it:
18+
The following example generates C4326 and shows how to fix it:
2019

2120
```cpp
2221
// C4326.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4329.md

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4329"
32
title: "Compiler Warning (level 1) C4329"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Warning (level 1) C4329"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C4329"]
66
helpviewer_keywords: ["C4329"]
77
---
88
# Compiler Warning (level 1) C4329
99

1010
> alignment specifier is ignored on enum
1111
12-
Use of the alignment specifiers on `enum` isn't allowed. This pattern includes the use of the [`align`](../../cpp/align-cpp.md) [`__declspec`](../../cpp/declspec.md) modifier. The following sample generates C4329:
12+
## Remarks
13+
14+
Use of the alignment specifiers on `enum` isn't allowed. This pattern includes the use of the [`align`](../../cpp/align-cpp.md) [`__declspec`](../../cpp/declspec.md) modifier.
15+
16+
## Example
17+
18+
The following example generates C4329:
1319

1420
```cpp
1521
// C4329.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4333.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,21 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4333"
32
title: "Compiler Warning (level 1) C4333"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Warning (level 1) C4333"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C4333"]
66
helpviewer_keywords: ["C4333"]
7-
ms.assetid: d3763c52-6110-4da0-84db-5264e3f3f166
87
---
98
# Compiler Warning (level 1) C4333
109

11-
'operator' : right shift by too large amount, data loss
10+
> 'operator' : right shift by too large amount, data loss
11+
12+
## Remarks
1213

1314
A right shift operation was too large an amount. All significant bits are shifted out and the result will always be zero.
1415

1516
## Example
1617

17-
The following sample generates C4333.
18+
The following example generates C4333.
1819

1920
```cpp
2021
// C4333.cpp
Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4340"
32
title: "Compiler Warning (level 1) C4340"
4-
ms.date: "11/04/2016"
3+
description: "Learn more about: Compiler Warning (level 1) C4340"
4+
ms.date: 11/04/2016
55
f1_keywords: ["C4340"]
66
helpviewer_keywords: ["C4340"]
7-
ms.assetid: ddd5344b-5167-4c55-a318-20615052fd54
87
---
98
# Compiler Warning (level 1) C4340
109

11-
'value' : value wrapped from positive to negative value
10+
> 'value' : value wrapped from positive to negative value
11+
12+
## Remarks
1213

1314
The **`enum`** value is greater than the largest **`enum`** positive value wrapped around to a negative value.

0 commit comments

Comments
 (0)