Skip to content
Open
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
6 changes: 4 additions & 2 deletions docs/error-messages/compiler-warnings/c4371.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
description: "Learn more about: Compiler Warning (level 3, off) C4371"
title: "Compiler Warning (level 3, off) C4371"
ms.date: "01/31/2018"
description: "Learn more about: Compiler Warning (level 3, off) C4371"
ms.date: 01/31/2018
f1_keywords: ["C4371"]
helpviewer_keywords: ["C4371"]
---
# Compiler Warning (level 3) C4371

> '*classname*': layout of class may have changed from a previous version of the compiler due to better packing of member '*member*'

## Remarks

Warning C4371 tells you that the layout created by the current compiler may be different from the layout generated by previous versions of the compiler. This difference may be significant for serialization operations or operating system interfaces that rely on a particular memory layout. In most other cases, this warning is safe to ignore.

Warning C4371 is off by default. For more information, see [Compiler Warnings That Are Off By Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md).
6 changes: 3 additions & 3 deletions docs/error-messages/compiler-warnings/c4388.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,17 @@ helpviewer_keywords: ["C4388"]

> '*token*' : signed/unsigned mismatch

Using the *token* operator to compare a **`signed`** and a larger **`unsigned`** number required the compiler to convert the **`signed`** value to the larger **`unsigned`** type.

## Remarks

Using the *token* operator to compare a **`signed`** and a larger **`unsigned`** number required the compiler to convert the **`signed`** value to the larger **`unsigned`** type.

One way to fix this warning is if you cast one of the two types when you compare **`signed`** and larger **`unsigned`** types.

This warning is off by default. You can use [/Wall](../../build/reference/compiler-option-warning-level.md) or **`/w44388`** to enable it on the command line as a level 4 warning. Or, use [`#pragma warning(default:4388)`](../../preprocessor/warning.md) in your source file. For more information, see [Compiler warnings that are off by default](../../preprocessor/compiler-warnings-that-are-off-by-default.md).

## Example

This sample generates C4388 and shows how to fix it:
This example generates C4388 and shows how to fix it:

```cpp
// C4388.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
description: "Learn more about: Compiler Warning (level 1, Error) C4368"
title: "Compiler Warning (level 1, Error) C4368"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1, Error) C4368"
ms.date: 11/04/2016
f1_keywords: ["C4368"]
helpviewer_keywords: ["C4368"]
---
# Compiler Warning (level 1, Error) C4368

> cannot define 'member' as a member of managed 'type': mixed types are not supported

## Remarks

You can't embed a native data member in a managed type.

You can, however, declare a pointer to a native type and control its lifetime in the constructor and destructor and finalizer of your managed class. For more information, see [Destructors and finalizers](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Destructors_and_finalizers).
Expand All @@ -17,7 +19,7 @@ This warning is always issued as an error. Use the [warning](../../preprocessor/

## Example

The following sample generates C4368.
The following example generates C4368.

```cpp
// C4368.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
description: "Learn more about: Compiler Warning (level 1, Error) C4394"
title: "Compiler Warning (level 1, Error) C4394"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1, Error) C4394"
ms.date: 11/04/2016
f1_keywords: ["C4394"]
helpviewer_keywords: ["C4394"]
---
# Compiler Warning (level 1, Error) C4394

> 'function' : per-appdomain symbol should not be marked with __declspec(dllexport)

## Remarks

A function marked with the [appdomain](../../cpp/appdomain.md) **`__declspec`** modifier is compiled to MSIL (not native), and export tables ([export](../../windows/attributes/export.md) **`__declspec`** modifier) aren't supported for managed functions.

You can declare a managed function to have public accessibility. For more information, see [Type visibility](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Type_visibility) and [Member visibility](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Member_visibility).
Expand All @@ -17,7 +19,7 @@ C4394 is always issued as an error. You can turn off this warning or change its

## Example

The following sample generates C4394.
The following example generates C4394.

```cpp
// C4394.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
---
description: "Learn more about: Compiler Warning (level 1) C4364"
title: "Compiler Warning (level 1) C4364"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4364"
ms.date: 11/04/2016
f1_keywords: ["C4364"]
helpviewer_keywords: ["C4364"]
ms.assetid: 1477634c-d60f-4570-ad16-1aaeae24ac7f
---
# Compiler Warning (level 1) C4364

\#using for assembly 'file' previously seen at location(line_number) without as_friend attribute; as_friend not applied
> #using for assembly 'file' previously seen at location(line_number) without as_friend attribute; as_friend not applied

## Remarks

A `#using` directive was repeated for a given metadata file, but the **`as_friend`** qualifier was not used in the first occurrence; the compiler will ignore the second **`as_friend`**.

For more information, see [Friend Assemblies (C++)](../../dotnet/friend-assemblies-cpp.md).

## Examples
## Example

The following sample creates a component.
The following example creates a component.

```cpp
// C4364.cpp
// compile with: /clr /LD
ref class A {};
```

The following sample generates C4364.
The following example generates C4364.

```cpp
// C4364_b.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4369"
title: "Compiler Warning (level 1) C4369"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4369"
ms.date: 11/04/2016
f1_keywords: ["C4369"]
helpviewer_keywords: ["C4369"]
ms.assetid: ade87e84-36be-4e00-be99-2930af848feb
---
# Compiler Warning (level 1) C4369

'enumerator' : enumerator value 'value' cannot be represented as 'type', value is 'new_value'
> 'enumerator' : enumerator value 'value' cannot be represented as 'type', value is 'new_value'

## Remarks

An enumerator was calculated to be greater than the greatest value for the specified underlying type. This caused an overflow and the compiler wrapped the enumerator value to the lowest possible value for the type.

## Example

The following sample generates C4369.
The following example generates C4369.

```cpp
// C4369.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) C4374"
title: "Compiler Warning (level 1) C4374"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4374"
ms.date: 11/04/2016
f1_keywords: ["C4374"]
helpviewer_keywords: ["C4374"]
ms.assetid: 4ac9aaec-d815-4b6e-825f-fa872092dd3b
---
# Compiler Warning (level 1) C4374

'function1': interface method will not be implemented by non-virtual method 'function2'
> 'function1': interface method will not be implemented by non-virtual method 'function2'

## Remarks

The compiler expected to find the [virtual](../../cpp/virtual-specifier.md) keyword on a method definition.

The following sample generates C4374:
## Example

The following example generates C4374:

```cpp
// C4374.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4375"
title: "Compiler Warning (level 1) C4375"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4375"
ms.date: 11/04/2016
f1_keywords: ["C4375"]
helpviewer_keywords: ["C4375"]
ms.assetid: a19821b5-e9b6-4228-abe7-d812507d6a2a
---
# Compiler Warning (level 1) C4375

non-public method 'method2' does not override 'method1'
> non-public method 'method2' does not override 'method1'

## Remarks

A type that implements another type defined an override method, but the override was not public. Therefore, the method does not override the base type method.
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4376"
title: "Compiler Warning (level 1) C4376"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4376"
ms.date: 11/04/2016
f1_keywords: ["C4376"]
helpviewer_keywords: ["C4376"]
ms.assetid: 5f202c74-9489-48fe-b36f-19cd882b1589
---
# Compiler Warning (level 1) C4376

access specifier 'old_specifier:' is no longer supported: please use 'new_specifier:' instead
> access specifier 'old_specifier:' is no longer supported: please use 'new_specifier:' instead

## Remarks

For more information on specifying type and member accessibility in metadata, see [Type visibility](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Type_visibility) and [Member visibility](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Member_visibility) in [How to: Define and Consume Classes and Structs (C++/CLI)](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md).

## Example

The following sample generates C4376.
The following example generates C4376.

```cpp
// C4376.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Warning (level 1) C4377"
title: "Compiler Warning (level 1) C4377"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4377"
ms.date: 11/04/2016
f1_keywords: ["C4377"]
helpviewer_keywords: ["C4377"]
ms.assetid: a1c797b8-cd5e-4a56-b430-d07932e811cf
---
# Compiler Warning (level 1) C4377

native types are private by default; -d1PrivateNativeTypes is deprecated
> native types are private by default; -d1PrivateNativeTypes is deprecated

## Remarks

In previous releases, native types in assemblies were public by default, and an internal, undocumented compiler option (**/d1PrivateNativeTypes**) was used to make them private.

All types, native and CLR, are now private by default in an assembly, so **/d1PrivateNativeTypes** is no longer needed.

## Example

The following sample generates C4377.
The following example generates C4377.

```cpp
// C4377.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4378"
title: "Compiler Warning (level 1) C4378"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4378"
ms.date: 11/04/2016
f1_keywords: ["C4378"]
helpviewer_keywords: ["C4378"]
ms.assetid: d08e11ef-891a-4752-9a5e-360e7394acf7
---
# Compiler Warning (level 1) C4378

Must obtain function pointers to run initializers; consider System::ModuleHandle::ResolveMethodHandle
> Must obtain function pointers to run initializers; consider System::ModuleHandle::ResolveMethodHandle

## Remarks

Under **/clr**, initializer symbols contain function tokens, not functions pointers. You need to convert tokens to pointers using <xref:System.ModuleHandle.ResolveMethodHandle%2A>.

## Examples
## Example

The following sample generates C4378.
The following example generates C4378.

```cpp
// C4378.cpp
Expand Down Expand Up @@ -56,7 +57,7 @@ int main () {
}
```

The following sample shows how to resolve C4378.
The following example shows how to resolve C4378.

```cpp
// C4378_b.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4379"
title: "Compiler Warning (level 1) C4379"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4379"
ms.date: 11/04/2016
f1_keywords: ["C4379"]
helpviewer_keywords: ["C4379"]
ms.assetid: b23e8132-69aa-4649-9c1e-09813b9fb5b7
---
# Compiler Warning (level 1) C4379

Version version of the common language runtime is not supported by this compiler. Using this version may cause unexpected results.
> Version version of the common language runtime is not supported by this compiler. Using this version may cause unexpected results.

## Remarks

You have a previous version of the common language runtime on your machine, but not the current version. To resolve C4379, install the version of the common language runtime that shipped with your compiler.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4381"
title: "Compiler Warning (level 1) C4381"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4381"
ms.date: 11/04/2016
f1_keywords: ["C4381"]
helpviewer_keywords: ["C4381"]
ms.assetid: f67a6db3-b334-4b2e-8182-b30c7a3c7c32
---
# Compiler Warning (level 1) C4381

'function1': interface method will not be implemented by non-public method 'function2'
> 'function1': interface method will not be implemented by non-public method 'function2'

## Remarks

A class must implement all function in an interface. A class can satisfy this condition if one of its base classes implements the function. However, the function must be implemented as a public function.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
description: "Learn more about: Compiler Warning (level 1) C4382"
title: "Compiler Warning (level 1) C4382"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4382"
ms.date: 11/04/2016
f1_keywords: ["C4382"]
helpviewer_keywords: ["C4382"]
ms.assetid: 34be9ad3-bae6-411a-8f80-0c8fd0d2c092
---
# Compiler Warning (level 1) C4382

Expand All @@ -22,7 +21,7 @@ For more information, see [/clr (Common Language Runtime Compilation)](../../bui

## Example

The following sample generates C4382.
The following example generates C4382.

```cpp
// C4382.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) C4383"
title: "Compiler Warning (level 1) C4383"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4383"
ms.date: 11/04/2016
f1_keywords: ["C4383"]
helpviewer_keywords: ["C4383"]
ms.assetid: 96c0e52d-874e-4b57-a154-0e49b6a00fae
---
# Compiler Warning (level 1) C4383

'instance_dereference_operator' : the meaning of dereferencing a handle can change, when a user-defined 'operator' operator exists; write the operator as a static function to be explicit about the operand
> 'instance_dereference_operator' : the meaning of dereferencing a handle can change, when a user-defined 'operator' operator exists; write the operator as a static function to be explicit about the operand

## Remarks

When you add a user-defined instance override of the dereference operator in a managed type, you potentially override the ability of the type's dereference operator to return the handle's object. Consider writing a static, user-defined dereference operator.

Expand All @@ -18,7 +19,7 @@ Also, an instance operator is not available to other language compilers via refe

## Example

The following sample generates C4383.
The following example generates C4383.

```cpp
// C4383.cpp
Expand Down
Loading