diff --git a/docs/error-messages/compiler-warnings/c4371.md b/docs/error-messages/compiler-warnings/c4371.md index aed32ad81b..44dfa2efae 100644 --- a/docs/error-messages/compiler-warnings/c4371.md +++ b/docs/error-messages/compiler-warnings/c4371.md @@ -1,7 +1,7 @@ --- -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"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["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). diff --git a/docs/error-messages/compiler-warnings/c4388.md b/docs/error-messages/compiler-warnings/c4388.md index ee8b36db8d..5f4c698f08 100644 --- a/docs/error-messages/compiler-warnings/c4388.md +++ b/docs/error-messages/compiler-warnings/c4388.md @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-c4368.md b/docs/error-messages/compiler-warnings/compiler-warning-c4368.md index 0d5f930532..94a975c3cd 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-c4368.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-c4368.md @@ -1,7 +1,7 @@ --- -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"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["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). @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-c4394.md b/docs/error-messages/compiler-warnings/compiler-warning-c4394.md index d49d391ea0..128be88cbc 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-c4394.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-c4394.md @@ -1,7 +1,7 @@ --- -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"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["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). @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4364.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4364.md index 3b84470325..43cd2ffc11 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4364.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4364.md @@ -1,22 +1,23 @@ --- -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 @@ -24,7 +25,7 @@ The following sample creates a component. ref class A {}; ``` -The following sample generates C4364. +The following example generates C4364. ```cpp // C4364_b.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4369.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4369.md index d3d741d775..23fc40ea41 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4369.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4369.md @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4374.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4374.md index 836a46f41a..4341cfc203 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4374.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4374.md @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4375.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4375.md index ccd68495cc..33fe16a7df 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4375.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4375.md @@ -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. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4376.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4376.md index fd0d5d27dd..ad88d8b689 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4376.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4376.md @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4377.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4377.md index 2c5b708fa0..1c326f787a 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4377.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4377.md @@ -1,14 +1,15 @@ --- -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. @@ -16,7 +17,7 @@ All types, native and CLR, are now private by default in an assembly, so **/d1Pr ## Example -The following sample generates C4377. +The following example generates C4377. ```cpp // C4377.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4378.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4378.md index d46842152e..2573597b3f 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4378.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4378.md @@ -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 . -## Examples +## Example -The following sample generates C4378. +The following example generates C4378. ```cpp // C4378.cpp @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4379.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4379.md index 8f56e1419a..9ed0d1e208 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4379.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4379.md @@ -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. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4381.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4381.md index 29e6cc6ddc..40eb33d0d7 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4381.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4381.md @@ -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. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4382.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4382.md index a0ba799310..18d02708b0 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4382.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4382.md @@ -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 @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4383.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4383.md index bd6efac7c9..77526a9e69 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4383.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4383.md @@ -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. @@ -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 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4384.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4384.md index ee4ea78178..bc7bcf67f1 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4384.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4384.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4384" title: "Compiler Warning (level 1) C4384" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4384" +ms.date: 11/04/2016 f1_keywords: ["C4384"] helpviewer_keywords: ["C4384"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["C4384"] > `#pragma` '*pragma_name*' should only be used at global scope +## Remarks + A `pragma` directive that must be applied at a global scope, was found in a different scope. The warning applies to the following `pragma` directives: @@ -18,7 +20,7 @@ The warning applies to the following `pragma` directives: ## Example -The following sample generates C4384. +The following example generates C4384. ```cpp // C4384.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4391.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4391.md index be45ba9d29..fd71f025e2 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4391.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4391.md @@ -1,20 +1,23 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4391" title: "Compiler Warning (level 1) C4391" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4391" +ms.date: 11/04/2016 f1_keywords: ["C4391"] helpviewer_keywords: ["C4391"] -ms.assetid: 95c6182c-fae9-4174-8f7b-98aa352e68ca --- # Compiler Warning (level 1) C4391 -'signature' : incorrect return type for intrinsic function, expected 'type' +> 'signature' : incorrect return type for intrinsic function, expected 'type' + +## Remarks A function declaration for a compiler intrinsic had the wrong return type. The resulting image may not run correctly. To fix this warning, either correct the declaration or delete the declaration and simply #include the appropriate header file. -The following sample generates C4391: +## Example + +The following example generates C4391: ```cpp // C4391.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4392.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4392.md index 79d7ebd020..01aadb254d 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4392.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4392.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 1, Error) C4392" title: "Compiler Warning (level 1, Error) C4392" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1, Error) C4392" +ms.date: 11/04/2016 f1_keywords: ["C4392"] helpviewer_keywords: ["C4392"] --- @@ -9,11 +9,15 @@ helpviewer_keywords: ["C4392"] > 'signature' : incorrect number of arguments for intrinsic function, expected 'number' arguments +## Remarks + A function declaration for a compiler intrinsic had the wrong number of arguments. The resulting image may not run correctly. To fix this warning, either correct the declaration or delete the declaration and `#include` the appropriate header file. This warning is always issued as an error. Use the [warning](../../preprocessor/warning.md) pragma to disable or change the warning level. -The following sample generates C4392: +## Example + +The following example generates C4392: ```cpp // C4392.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4393.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4393.md index 2e0d6b6e8e..82cf3e5048 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4393.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4393.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4393" title: "Compiler Warning (level 1) C4393" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4393" +ms.date: 11/04/2016 f1_keywords: ["C4393"] helpviewer_keywords: ["C4393"] -ms.assetid: 353a0539-d1ea-4c1b-8849-c9b321ec9842 --- # Compiler Warning (level 1) C4393 -'var' : const has no effect on literal data member; ignored +> 'var' : const has no effect on literal data member; ignored + +## Remarks A [literal](../../extensions/literal-cpp-component-extensions.md) data member was also specified as const. Since a literal data member implies const, you do not need to add const to the declaration. -The following sample generates C4393: +## Example + +The following example generates C4393: ```cpp // C4393.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4395.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4395.md index 98523b30ba..eb6c4a2741 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4395.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4395.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4395" title: "Compiler Warning (level 1) C4395" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4395" +ms.date: 11/04/2016 f1_keywords: ["C4395"] helpviewer_keywords: ["C4395"] -ms.assetid: 8051469a-3a39-4677-80f7-1300fbffe8ea --- # Compiler Warning (level 1) C4395 -'function' : member function will be invoked on a copy of the initonly data member 'member' +> 'function' : member function will be invoked on a copy of the initonly data member 'member' + +## Remarks A member function was called on an [initonly (C++/CLI)](../../dotnet/initonly-cpp-cli.md) data member. C4395 warns that the **initonly** data member cannot be modified by the function. -The following sample generates C4395: +## Example + +The following example generates C4395: ```cpp // C4395.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4397.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4397.md index f957af30e6..2e639136c2 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4397.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4397.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4397" title: "Compiler Warning (level 1) C4397" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4397" +ms.date: 11/04/2016 f1_keywords: ["C4397"] helpviewer_keywords: ["C4397"] -ms.assetid: 6346fdc2-dbbf-4fba-803a-32b0d0a707be --- # Compiler Warning (level 1) C4397 -DefaultCharSetAttribute is ignored +> DefaultCharSetAttribute is ignored + +## Remarks is ignored by the Microsoft C++ compiler. To specify a character set for the DLL, use the CharSet option of DllImport. For more information, see [Using C++ Interop (Implicit PInvoke)](../../dotnet/using-cpp-interop-implicit-pinvoke.md). ## Example -The following sample generates C4397. +The following example generates C4397. ```cpp // C4397.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4399.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4399.md index 39947ec818..b3d523f9ed 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4399.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4399.md @@ -1,10 +1,9 @@ --- -description: "Learn more about: Compiler Warning (level 1, Error) C4399" title: "Compiler Warning (level 1, Error) C4399" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1, Error) C4399" +ms.date: 11/04/2016 f1_keywords: ["C4399"] helpviewer_keywords: ["C4399"] -ms.assetid: f58d9ba7-71a0-4c3b-b26f-f946dda8af30 --- # Compiler Warning (level 1, Error) C4399 @@ -20,7 +19,7 @@ This warning can be issued as an error. Use the [warning](../../preprocessor/war ## Example -The following sample generates C4399. +The following example generates C4399. ```cpp // C4399.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4396.md b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4396.md index e4306463bc..5bb56d3be8 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4396.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4396.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 2) C4396" title: "Compiler Warning (level 2) C4396" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 2) C4396" +ms.date: 11/04/2016 f1_keywords: ["C4396"] helpviewer_keywords: ["C4396"] -ms.assetid: 7cd6b283-db17-4574-b299-03e0b913ad70 --- # Compiler Warning (level 2) C4396 -"name" : the inline specifier cannot be used when a friend declaration refers to a specialization of a function template +> "name" : the inline specifier cannot be used when a friend declaration refers to a specialization of a function template + +## Remarks A specialization of a function template cannot specify any of the [inline](../../cpp/inline-functions-cpp.md) specifiers. The compiler issues warning C4396 and ignores the inline specifier. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4390.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4390.md index 813df6cac7..6ed88b3ea8 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4390.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4390.md @@ -1,20 +1,23 @@ --- -description: "Learn more about: Compiler Warning (level 3) C4390" title: "Compiler Warning (level 3) C4390" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3) C4390" +ms.date: 11/04/2016 f1_keywords: ["C4390"] helpviewer_keywords: ["C4390"] -ms.assetid: c95c2f1b-9bce-4b1f-a80c-565d4cde0b1e --- # Compiler Warning (level 3) C4390 -';' : empty controlled statement found; is this the intent? +> ';' : empty controlled statement found; is this the intent? + +## Remarks A semicolon was found after a control statement that contains no instructions. If you get C4390 because of a macro, you should use the [warning](../../preprocessor/warning.md) pragma to disable C4390 in the module containing the macro. -The following sample generates C4390: +## Example + +The following example generates C4390: ```cpp // C4390.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4398.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4398.md index 394219283d..fd2f161dca 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4398.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4398.md @@ -1,10 +1,9 @@ --- -description: "Learn more about: Compiler Warning (level 3) C4398" title: "Compiler Warning (level 3) C4398" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3) C4398" +ms.date: 11/04/2016 f1_keywords: ["C4398"] helpviewer_keywords: ["C4398"] -ms.assetid: b6221432-9fed-4272-a547-a73f587904e6 --- # Compiler Warning (level 3) C4398 @@ -20,7 +19,7 @@ For more information, see [appdomain](../../cpp/appdomain.md) and [Application D ## Example -The following sample generates C4398. +The following example generates C4398. ```cpp // C4398.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4365.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4365.md index d26dec6ad7..25320e16d2 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4365.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4365.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 4, off) C4365" title: "Compiler Warning (level 4, off) C4365" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4, off) C4365" +ms.date: 11/04/2016 f1_keywords: ["C4365"] helpviewer_keywords: ["C4365"] --- @@ -9,13 +9,15 @@ helpviewer_keywords: ["C4365"] > 'action' : conversion from 'type_1' to 'type_2', signed/unsigned mismatch +## Remarks + For example, you tried to convert an unsigned value to a signed value. This pattern can cause unexpected results when the source value at runtime in not in the range of the destination type. Such as a negative value being converted into a signed value. C4365 is off by default. For more information, see [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md). ## Example -The following sample generates C4365. +The following example generates C4365. ```cpp // C4365.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4366.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4366.md index 8ffd8a63f5..91679dc7ba 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4366.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4366.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4366" title: "Compiler Warning (level 4) C4366" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4366" +ms.date: 11/04/2016 f1_keywords: ["C4366"] helpviewer_keywords: ["C4366"] -ms.assetid: 65d2942f-3741-42f4-adf2-4920d5a055ca --- # Compiler Warning (level 4) C4366 -The result of the unary 'operator' operator may be unaligned +> The result of the unary 'operator' operator may be unaligned + +## Remarks If a structure member could ever be unaligned because of packing, the compiler will warn when that member's address is assigned to an aligned pointer. By default, all pointers are aligned. @@ -18,7 +19,7 @@ For more information, see __unaligned and [pack](../../preprocessor/pack.md). ## Example -The following sample generates C4366. +The following example generates C4366. ```cpp // C4366.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4389.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4389.md index ce2dce28c3..0de7bed8b0 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4389.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4389.md @@ -9,15 +9,15 @@ helpviewer_keywords: ["C4389"] > '*equality-operator*' : signed/unsigned mismatch -An **`==`** or **`!=`** operation involved **`signed`** and **`unsigned`** variables. This could result in a loss of data. - ## Remarks +An **`==`** or **`!=`** operation involved **`signed`** and **`unsigned`** variables. This could result in a loss of data. + One way to fix this warning is if you cast one of the two types when you compare **`signed`** and **`unsigned`** types. ## Example -The following sample generates C4389: +The following example generates C4389: ```cpp // C4389.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4400.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4400.md index a97330018c..75de9e5fcd 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4400.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4400.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 4, error) C4400" title: "Compiler warning (level 4, error) C4400" -ms.date: "1/22/2025" +description: "Learn more about: Compiler Warning (level 4, error) C4400" +ms.date: 1/22/2025 f1_keywords: ["C4400"] helpviewer_keywords: ["C4400"] --- @@ -9,11 +9,13 @@ helpviewer_keywords: ["C4400"] > '*type*': `const`/`volatile` qualifiers on this type are not supported +## Remarks + The [`const`](../../cpp/const-cpp.md) and [`volatile`](../../cpp/volatile-cpp.md) qualifiers don't work with common language runtime typed variables. ## Example -The following sample generates C4400. +The following example generates C4400. ```cpp // C4400.cpp