Skip to content

Commit cea02c8

Browse files
authored
Add "Remarks" and "Example" headings for warning references in range [C4701, C4750]
1 parent 8dd0050 commit cea02c8

28 files changed

+79
-5
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 5e79ab46-6031-499a-a986-716c866b6c0e
1010

1111
> volatile access of '\<expression>' is subject to /volatile:[iso\|ms] setting; consider using __iso_volatile_load/store intrinsic functions.
1212
13+
## Remarks
14+
1315
C4746 is emitted whenever a volatile variable is accessed directly. It's intended to help developers identify code locations that are affected by the specific volatile model currently specified (which can be controlled with the [`/volatile`](../../build/reference/volatile-volatile-keyword-interpretation.md) compiler option). In particular, it can be useful in locating compiler-generated hardware memory barriers when `/volatile:ms` is used.
1416

1517
The __iso_volatile_load/store intrinsics can be used to explicitly access volatile memory without being affected by the volatile model. Using these intrinsics will not trigger C4746.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 270506ab-fead-4328-b714-2978113be238
1010

1111
> function 'function' selected for inline expansion
1212
13+
## Remarks
14+
1315
The compiler performed inlining on the given function, although it was not marked for inlining.
1416

1517
C4711 is enabled if [/Ob2](../../build/reference/ob-inline-function-expansion.md) is specified.

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 1c819bf7-0d8b-4f5e-b338-9cc292870439
1010

1111
> 'function' : not all control paths return a value
1212
13+
## Remarks
14+
1315
The specified function can potentially not return a value.
1416

1517
## Example

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: d95ecfe5-870f-461f-a746-7913af98414b
1010

1111
> 'function' must return a value
1212
13+
## Remarks
14+
1315
The given function did not return a value.
1416

1517
Only functions with a return type of void can use the return command without an accompanying return value.
@@ -18,6 +20,8 @@ An undefined value will be returned when this function is called.
1820

1921
This warning is automatically promoted to an error. If you wish to modify this behavior, use [#pragma warning](../../preprocessor/warning.md).
2022

23+
## Example
24+
2125
The following sample generates C4716:
2226

2327
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 5ef3c6c7-8599-4714-a973-0f5b69cdab3c
1010

1111
> 'function' : recursive on all control paths, function will cause runtime stack overflow
1212
13+
## Remarks
14+
1315
Every path through a function contains a call to the function. Since there is no way to exit the function without first calling itself recursively, the function will never exit.
1416

17+
## Example
18+
1519
The following sample generates C4717:
1620

1721
```cpp

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

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

1010
> 'function' : destructor never returns, potential memory leak
1111
12+
## Remarks
13+
1214
The flow of control terminates in a destructor. The thread or the entire program will terminate and allocated resources may not be released. Furthermore, if a destructor will be called for stack unwinding during exception processing, the behavior of executable is undefined.
1315

1416
To resolve, remove the function call that causes the destructor to not return.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,17 @@ ms.assetid: 991b0087-3a50-40f5-9cdb-cdc367cd472c
1010

1111
> "PCH named pch_file with same timestamp found in obj_file_1 and obj_file_2. Using first PCH.
1212
13+
## Remarks
14+
1315
> [!NOTE]
1416
> In Visual Studio 2017 and earlier, the precompiled header is called *stdafx.h* by default, and in Visual Studio 2019 and later, it is called *pch.h* by default.
1517
1618
C4727 occurs when compiling multiple compilands with **/Yc**, and where the compiler was able to mark all .obj files with the same .pch timestamp.
1719

1820
To resolve, compile one source file with **/Yc /c** (creates pch), and the others compile separately with **/Yu /c** (uses pch), then link them together.
1921

22+
## Example
23+
2024
So, if you did the following and it generates C4727:
2125

2226
::: moniker range="<=msvc-150"

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ ms.assetid: 36a0151f-f258-48d9-9444-ae6d41ff70a4
1010

1111
> function too big for flow graph based warnings
1212
13+
## Remarks
14+
1315
This warning is generated when a function is too big to be compiled with reliable checking for situations that would generate a warning. This warning is only generated when the [/Od](../../build/reference/od-disable-debug.md) compiler option used.
1416

1517
To resolve this warning, break the function into smaller functions.

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,14 @@ ms.assetid: 11303e3f-162b-4b19-970a-479686123a68
1010

1111
> 'main' : mixing _m64 and floating point expressions may result in incorrect code
1212
13+
## Remarks
14+
1315
A function uses [__m64](../../cpp/m64.md) and **`float`**/**`double`** types. Because the MMX and floating-point registers share the same physical register space (cannot be used simultaneously), using **`__m64`** and **`float`**/**`double`** types in the same function can result in data corruption, possibly causing an exception.
1416

1517
To safely use **`__m64`** types and floating-point types in the same function, each instruction that uses one of the types should be separated by the **_m_empty()** (for MMX) or **_m_femms()** (for 3DNow!) intrinsic.
1618

19+
## Example
20+
1721
The following sample generates C4730:
1822

1923
```cpp

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,12 @@ ms.assetid: 5658c24c-3e6f-4505-835b-1fb92d47cab0
1010

1111
> 'pointer' : frame pointer register 'register' modified by inline assembly code
1212
13+
## Remarks
14+
1315
A frame pointer register was modified. You must save and restore the register in your inline assembly block or frame variable (local or parameter, depending on the register modified), or your code may not work properly.
1416

17+
## Example
18+
1519
The following sample generates C4731:
1620

1721
```cpp

0 commit comments

Comments
 (0)