Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning C4746"
title: "Compiler Warning C4746"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning C4746"
ms.date: 11/04/2016
f1_keywords: ["C4746"]
helpviewer_keywords: ["C4746"]
ms.assetid: 5e79ab46-6031-499a-a986-716c866b6c0e
---
# Compiler Warning C4746

volatile access of '\<expression>' is subject to /volatile:[iso\|ms] setting; consider using __iso_volatile_load/store intrinsic functions.
> volatile access of '\<expression>' is subject to /volatile:[iso\|ms] setting; consider using __iso_volatile_load/store intrinsic functions.

## Remarks

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.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (level 1) C4711"
title: "Compiler Warning (level 1) C4711"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4711"
ms.date: 11/04/2016
f1_keywords: ["C4711"]
helpviewer_keywords: ["C4711"]
ms.assetid: 270506ab-fead-4328-b714-2978113be238
---
# Compiler Warning (level 1) C4711

function 'function' selected for inline expansion
> function 'function' selected for inline expansion

## Remarks

The compiler performed inlining on the given function, although it was not marked for inlining.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
description: "Learn more about: Compiler Warning (level 1) C4715"
title: "Compiler Warning (level 1) C4715"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4715"
ms.date: 11/04/2016
f1_keywords: ["C4715"]
helpviewer_keywords: ["C4715"]
ms.assetid: 1c819bf7-0d8b-4f5e-b338-9cc292870439
---
# Compiler Warning (level 1) C4715

'function' : not all control paths return a value
> 'function' : not all control paths return a value

## Remarks

The specified function can potentially not return a value.

## Example

The following example generates C4715:

```cpp
// C4715a.cpp
// compile with: /W1 /LD
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (level 1) C4716"
title: "Compiler Warning (level 1) C4716"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4716"
ms.date: 11/04/2016
f1_keywords: ["C4716"]
helpviewer_keywords: ["C4716"]
ms.assetid: d95ecfe5-870f-461f-a746-7913af98414b
---
# Compiler Warning (level 1) C4716

'function' must return a value
> 'function' must return a value

## Remarks

The given function did not return a value.

Expand All @@ -18,7 +19,9 @@ An undefined value will be returned when this function is called.

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

The following sample generates C4716:
## Example

The following example generates C4716:

```cpp
// C4716.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4717"
title: "Compiler Warning (level 1) C4717"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4717"
ms.date: 11/04/2016
f1_keywords: ["C4717"]
helpviewer_keywords: ["C4717"]
ms.assetid: 5ef3c6c7-8599-4714-a973-0f5b69cdab3c
---
# Compiler Warning (level 1) C4717

'function' : recursive on all control paths, function will cause runtime stack overflow
> 'function' : recursive on all control paths, function will cause runtime stack overflow

## Remarks

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.

The following sample generates C4717:
## Example

The following example generates C4717:

```cpp
// C4717.cpp
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,17 @@ helpviewer_keywords: ["C4722"]
---
# Compiler Warning (level 1) C4722

'function' : destructor never returns, potential memory leak
> 'function' : destructor never returns, potential memory leak

## Remarks

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.

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

## Example

The following sample generates C4722:
The following example generates C4722:

```cpp
// C4722.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (level 1) C4727"
title: "Compiler Warning (level 1) C4727"
ms.date: "08/19/2019"
description: "Learn more about: Compiler Warning (level 1) C4727"
ms.date: 08/19/2019
f1_keywords: ["C4727"]
helpviewer_keywords: ["C4727"]
ms.assetid: 991b0087-3a50-40f5-9cdb-cdc367cd472c
---
# Compiler Warning (level 1) C4727

"PCH named pch_file with same timestamp found in obj_file_1 and obj_file_2. Using first PCH.
> "PCH named pch_file with same timestamp found in obj_file_1 and obj_file_2. Using first PCH.

## Remarks

> [!NOTE]
> 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.
Expand All @@ -17,6 +18,8 @@ C4727 occurs when compiling multiple compilands with **/Yc**, and where the comp

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.

## Example

So, if you did the following and it generates C4727:

::: moniker range="<=msvc-150"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (Level 1) C4729"
title: "Compiler Warning (Level 1) C4729"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (Level 1) C4729"
ms.date: 11/04/2016
f1_keywords: ["C4729"]
helpviewer_keywords: ["C4729"]
ms.assetid: 36a0151f-f258-48d9-9444-ae6d41ff70a4
---
# Compiler Warning (Level 1) C4729

function too big for flow graph based warnings
> function too big for flow graph based warnings

## Remarks

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.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Warning (Level 1) C4730"
title: "Compiler Warning (Level 1) C4730"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (Level 1) C4730"
ms.date: 11/04/2016
f1_keywords: ["C4730"]
helpviewer_keywords: ["C4730"]
ms.assetid: 11303e3f-162b-4b19-970a-479686123a68
---
# Compiler Warning (Level 1) C4730

'main' : mixing _m64 and floating point expressions may result in incorrect code
> 'main' : mixing _m64 and floating point expressions may result in incorrect code

## Remarks

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.

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.

The following sample generates C4730:
## Example

The following example generates C4730:

```cpp
// C4730.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Warning (Level 1) C4731"
title: "Compiler Warning (Level 1) C4731"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (Level 1) C4731"
ms.date: 11/04/2016
f1_keywords: ["C4731"]
helpviewer_keywords: ["C4731"]
ms.assetid: 5658c24c-3e6f-4505-835b-1fb92d47cab0
---
# Compiler Warning (Level 1) C4731

'pointer' : frame pointer register 'register' modified by inline assembly code
> 'pointer' : frame pointer register 'register' modified by inline assembly code

## Remarks

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.

The following sample generates C4731:
## Example

The following example generates C4731:

```cpp
// C4731.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Warning (Level 1) C4733"
title: "Compiler Warning (Level 1) C4733"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (Level 1) C4733"
ms.date: 11/04/2016
f1_keywords: ["C4733"]
helpviewer_keywords: ["C4733"]
ms.assetid: 7ef4f577-772d-4b66-a7bf-8958a6b250bc
---
# Compiler Warning (Level 1) C4733

Inline asm assigning to 'FS:0' : handler not registered as safe handler
> Inline asm assigning to 'FS:0' : handler not registered as safe handler

## Remarks

A function modifying the value at FS:0 to add a new exception handler may not work with Safe Exceptions, because the handler may not be registered as a valid exception handler (see [/SAFESEH](../../build/reference/safeseh-image-has-safe-exception-handlers.md)).

To resolve this warning, either remove the FS:0 definition or turn off this warning and use [.SAFESEH](../../assembler/masm/dot-safeseh.md) to specify the safe exception handlers.

The following sample generates C4733:
## Example

The following example generates C4733:

```cpp
// C4733.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Warning (Level 1) C4739"
title: "Compiler Warning (Level 1) C4739"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (Level 1) C4739"
ms.date: 11/04/2016
f1_keywords: ["C4739"]
helpviewer_keywords: ["C4739"]
ms.assetid: 600873b3-7c85-4cd4-944e-cd8e01bfcbb0
---
# Compiler Warning (Level 1) C4739

reference to variable 'var' exceeds its storage space
> reference to variable 'var' exceeds its storage space

## Remarks

A value was assigned to a variable, but the value is greater than the size of the variable. Memory will be written beyond the variable's memory location, and data loss is possible.

To resolve this warning, only assign a value to a variable whose size can accommodate the value.

The following sample generates C4739:
## Example

The following example generates C4739:

```cpp
// C4739.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
---
description: "Learn more about: Compiler Warning (Level 1) C4742"
title: "Compiler Warning (Level 1) C4742"
description: "Learn more about: Compiler Warning (Level 1) C4742"
ms.date: 07/22/2020
f1_keywords: ["C4742"]
helpviewer_keywords: ["C4742"]
ms.assetid: e520881d-1eeb-48b1-9df0-8017ee8ba076
---
# Compiler Warning (Level 1) C4742

> '*variable*' has different alignment in '*file1*' and '*file2*': *number1* and *number2*

An external variable that was referenced or defined in two files has different alignment in those files.

## Remarks

An external variable that was referenced or defined in two files has different alignment in those files.

This warning is emitted when compiler finds that **`alignof`** for the variable in *file1* differs from **`alignof`** for the variable in *file2*. This can be caused by using incompatible types when declaring variable in different files, or by using non-matching `#pragma pack` in different files.

To resolve this warning, either use the same type definition or use different names for the variables.
Expand All @@ -32,7 +31,7 @@ struct X {
} global;
```

The following sample generates C4742.
The following example generates C4742.

```c
// C4742b.c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,25 @@
---
description: "Learn more about: Compiler Warning (Level 1) C4743"
title: "Compiler Warning (Level 1) C4743"
description: "Learn more about: Compiler Warning (Level 1) C4743"
ms.date: 06/16/2022
f1_keywords: ["C4743"]
helpviewer_keywords: ["C4743"]
ms.assetid: 2ee76ea3-77f3-4c2f-9a57-0751823c89fd
---
# Compiler Warning (Level 1) C4743

> '*type*' has different size in '*file1*' and '*file2*': *size_1* and *size_2* bytes

An external variable referenced or defined in two files has different types in those files, and the compiler determined that the size of the variable in *file1* differs from the size of the variable in *file2*.

## Remarks

An external variable referenced or defined in two files has different types in those files, and the compiler determined that the size of the variable in *file1* differs from the size of the variable in *file2*.

There's an important case when this warning can be emitted for C++. If you declare class types with the same name in two different files, if those declarations contain virtual functions, and if the declarations aren't the same, then the compiler can emit warning C4744 for the virtual function tables. The warning occurs because there are two different-sized virtual function tables for the same type, and the linker must choose one of them to incorporate into the executable. It's possible that it can result in your program calling the wrong virtual function.

To resolve this warning, either use the same type definition or use different names for the types or variables.

## Example

The following sample generates C4743. To compile it, place both files in the same folder, then run this command in a developer command prompt:
The following example generates C4743. To compile it, place both files in the same folder, then run this command in a developer command prompt:

```cmd
cl /EHsc /W1 /GL /O2 C4743a.cpp C4743b.cpp
Expand Down
Loading