diff --git a/docs/error-messages/compiler-warnings/compiler-warning-c4430.md b/docs/error-messages/compiler-warnings/compiler-warning-c4430.md index 6814fb10c3..82777f1145 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-c4430.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-c4430.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Warning (level 1, error) C4430" title: "Compiler warning (level 1, error) C4430" +description: "Learn more about: Compiler Warning (level 1, error) C4430" ms.date: 04/22/2025 f1_keywords: ["C4430"] helpviewer_keywords: ["C4430"] @@ -9,13 +9,15 @@ helpviewer_keywords: ["C4430"] > missing type specifier - int assumed. Note: C++ does not support default-int +## Remarks + This warning is issued when a type specifier is missing in a declaration. The compiler used to assume the type was `int` in this case. But due to compiler conformance work done for Visual Studio 2005, all declarations must explicitly specify the type. C4430 is always issued as an error. You can turn off this warning with the `#pragma warning` or `/wd`. For more information, see [`warning`](../../preprocessor/warning.md) or [`/w`, `/W0`, `/W1`, `/W2`, `/W3`, `/W4`, `/w1`, `/w2`, `/w3`, `/w4`, `/Wall`, `/wd`, `/we`, `/wo`, `/Wv`, `/WX` (Warning Level)](../../build/reference/compiler-option-warning-level.md). ## Example -The following sample generates C4430: +The following example generates C4430: ```cpp // compile with: /c diff --git a/docs/error-messages/compiler-warnings/compiler-warning-c4439.md b/docs/error-messages/compiler-warnings/compiler-warning-c4439.md index 9608a6c02c..b4b5b4ffc3 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-c4439.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-c4439.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 1, error) C4439" title: "Compiler warning (level 1, error) C4439" -ms.date: "1/22/2025" +description: "Learn more about: Compiler Warning (level 1, error) C4439" +ms.date: 1/22/2025 f1_keywords: ["C4439"] helpviewer_keywords: ["C4439"] --- @@ -9,13 +9,15 @@ helpviewer_keywords: ["C4439"] > '*function name*': function definition with a managed type in the signature must have a `__clrcall` calling convention +## Remarks + The compiler implicitly replaced a calling convention with [`__clrcall`](../../cpp/clrcall.md). To resolve this warning, remove the **`__cdecl`** or **`__stdcall`** calling convention. C4439 is always issued as an error. You can turn off this warning with the `#pragma warning` or **`/wd`**. For more information, see [`warning`](../../preprocessor/warning.md) or [`/w`, `/W0`, `/W1`, `/W2`, `/W3`, `/W4`, `/w1`, `/w2`, `/w3`, `/w4`, `/Wall`, `/wd`, `/we`, `/wo`, `/Wv`, `/WX` (Warning Level)](../../build/reference/compiler-option-warning-level.md). ## Example -The following sample generates C4439: +The following example generates C4439: ```cpp // C4439.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4401.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4401.md index 8bc6447524..0e77fd61c5 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4401.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4401.md @@ -1,18 +1,23 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4401" title: "Compiler Warning (level 1) C4401" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4401" +ms.date: 11/04/2016 f1_keywords: ["C4401"] helpviewer_keywords: ["C4401"] -ms.assetid: 2e7ca136-f144-4b40-b847-82976e8643fc --- # Compiler Warning (level 1) C4401 -'bitfield' : member is bit field +> 'bitfield' : member is bit field + +## Remarks Inline assembly code tries to access a bit-field member. Inline assembly cannot access bit-field members, so the last packing boundary before the bit-field member is used. -To avoid this warning, cast the bit field to an appropriate type before making the reference in inline assembly code. The following sample generates C4401: +To avoid this warning, cast the bit field to an appropriate type before making the reference in inline assembly code. + +## Example + +The following example generates C4401: ```cpp // C4401.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4402.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4402.md index 564054771a..986cfddad8 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4402.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4402.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4402" title: "Compiler Warning (level 1) C4402" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4402" +ms.date: 11/04/2016 f1_keywords: ["C4402"] helpviewer_keywords: ["C4402"] -ms.assetid: 2aaecfae-1e79-4787-87e8-0973f7ec0efe --- # Compiler Warning (level 1) C4402 -must use PTR operator +> must use PTR operator + +## Remarks A type is used on an operand without a PTR operator when referring to or casting to a type in inline assembly code. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4403.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4403.md index 1d3e599dcb..afb02f7bd0 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4403.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4403.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4403" title: "Compiler Warning (level 1) C4403" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4403" +ms.date: 11/04/2016 f1_keywords: ["C4403"] helpviewer_keywords: ["C4403"] -ms.assetid: d95597c9-4762-4f33-86e4-1d98f0e80d52 --- # Compiler Warning (level 1) C4403 -illegal PTR operator +> illegal PTR operator + +## Remarks A PTR operator is used inappropriately in inline assembler code. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4405.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4405.md index b2ad983ac7..92efb9f9ab 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4405.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4405.md @@ -1,16 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4405" title: "Compiler Warning (level 1) C4405" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4405" +ms.date: 11/04/2016 f1_keywords: ["C4405"] helpviewer_keywords: ["C4405"] -ms.assetid: 155c64d6-58ae-4455-b61f-ccd711c5da96 --- # Compiler Warning (level 1) C4405 -'identifier' : identifier is reserved word +> 'identifier' : identifier is reserved word + +## Remarks + +A word reserved for inline assembly is used as a variable name. This may cause unpredictable results. To fix this warning, avoid naming variables with words reserved for inline assembly. + +## Example -A word reserved for inline assembly is used as a variable name. This may cause unpredictable results. To fix this warning, avoid naming variables with words reserved for inline assembly. The following sample generates C4405: +The following example generates C4405: ```cpp // C4405.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4406.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4406.md index 56566edc0f..e600ed36ea 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4406.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4406.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4406" title: "Compiler Warning (level 1) C4406" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4406" +ms.date: 11/04/2016 f1_keywords: ["C4406"] helpviewer_keywords: ["C4406"] -ms.assetid: a3204731-2285-401c-b73b-af98586a86fa --- # Compiler Warning (level 1) C4406 -operand on directive ignored +> operand on directive ignored + +## Remarks The directive does not take any operands, but an operand was specified. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4407.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4407.md index c206a7b8cd..88b9df38c3 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4407.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4407.md @@ -1,6 +1,6 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4407" title: "Compiler Warning (level 1) C4407" +description: "Learn more about: Compiler Warning (level 1) C4407" ms.date: 04/13/2021 f1_keywords: ["C4407"] helpviewer_keywords: ["C4407"] @@ -9,17 +9,17 @@ helpviewer_keywords: ["C4407"] > cast between different pointer to member representations, compiler may generate incorrect code -An incorrect cast between pointer-to-member types was detected. - ## Remarks +An incorrect cast between pointer-to-member types was detected. + C4407 can be generated because of compiler conformance work that was done in Visual Studio 2005. Pointer-to-member now requires a qualified name and the address-of operator (&). C4407 can occur if you cast between a multiple inheritance pointer-to-member to a single inheritance pointer-to-member. Sometimes this can work, but sometimes it can't because the single inheritance pointer-to-member representation doesn't hold sufficient information. Compiling with the **`/vmm`** might help. For more information, see [`/vmm`, `/vms`, `/vmv` (General purpose representation)](../../build/reference/vmm-vms-vmv-general-purpose-representation.md). You can also try rearranging your base classes; the compiler is detecting a loss of information in the conversion because a base class is at a non-zero offset from the derived. ## Example -The following sample generates C4407 and shows how to fix it: +The following example generates C4407 and shows how to fix it: ```cpp // C4407.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4409.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4409.md index 66f2c9b2a9..6f4a121e0b 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4409.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4409.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4409" title: "Compiler Warning (level 1) C4409" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4409" +ms.date: 11/04/2016 f1_keywords: ["C4409"] helpviewer_keywords: ["C4409"] -ms.assetid: 2be63c86-d9c9-4073-ab71-e654dd9f450f --- # Compiler Warning (level 1) C4409 -illegal instruction size +> illegal instruction size + +## Remarks The instruction did not have a form with the specified size. The smallest legal size was used. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4410.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4410.md index 99784780d9..391e7ca230 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4410.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4410.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4410" title: "Compiler Warning (level 1) C4410" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4410" +ms.date: 11/04/2016 f1_keywords: ["C4410"] helpviewer_keywords: ["C4410"] -ms.assetid: 7dcdb720-118a-4823-ba73-575f6ad79a71 --- # Compiler Warning (level 1) C4410 -illegal size for operand +> illegal size for operand + +## Remarks One of the operands on the instruction had an incorrect size. The smallest legal size for the operand was used. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4411.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4411.md index 3170200a5f..04ee68c961 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4411.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4411.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4411" title: "Compiler Warning (level 1) C4411" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4411" +ms.date: 11/04/2016 f1_keywords: ["C4411"] helpviewer_keywords: ["C4411"] -ms.assetid: d209452c-83bd-4333-8d0b-759ca9b4864e --- # Compiler Warning (level 1) C4411 -'identifier' : symbol resolves to displacement register +> 'identifier' : symbol resolves to displacement register + +## Remarks The identifier is a local symbol that resolves to a displacement register and therefore may be used on an operand with another symbol. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4420.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4420.md index e506c3e258..912f91fef5 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4420.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4420.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4420" title: "Compiler Warning (level 1) C4420" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4420" +ms.date: 11/04/2016 f1_keywords: ["C4420"] helpviewer_keywords: ["C4420"] -ms.assetid: 44a37754-7ddd-4764-a5f7-d33e05c20091 --- # Compiler Warning (level 1) C4420 -'operator' : operator not available, using 'operator' instead; run-time checking may be compromised +> 'operator' : operator not available, using 'operator' instead; run-time checking may be compromised + +## Remarks This warning is generated when you use the [/RTCv](../../build/reference/rtc-run-time-error-checks.md) (vector new/delete checking) and when no vector form is found. In this case, the non-vector form is used. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4436.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4436.md index 9b3e694ede..e2565cf011 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4436.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4436.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 1 and level 4) C4436" title: "Compiler warning (level 1 and level 4) C4436" -ms.date: "1/22/2025" +description: "Learn more about: Compiler Warning (level 1 and level 4) C4436" +ms.date: 1/22/2025 f1_keywords: ["C4436"] helpviewer_keywords: ["C4436"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["C4436"] > `dynamic_cast` from virtual base '*base_class*' to '*derived_class*' in constructor or destructor could fail with partially-constructed object +## Remarks + A `dynamic_cast` operation is used when: - The cast is from a base class pointer to a derived class pointer. @@ -20,7 +22,7 @@ This warning indicates that the `dynamic_cast` might not perform correctly if it ## Example -The following sample generates C4436 and demonstrates the code generation issue due to the missing `vtordisp` field: +The following example generates C4436 and demonstrates the code generation issue due to the missing `vtordisp` field: ```cpp // C4436.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4440.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4440.md index a85bcc3b98..27027d4423 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4440.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4440.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4440" title: "Compiler Warning (level 1) C4440" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4440" +ms.date: 11/04/2016 f1_keywords: ["C4440"] helpviewer_keywords: ["C4440"] -ms.assetid: 78b9642a-a93e-401e-9d92-372f6451bc5d --- # Compiler Warning (level 1) C4440 -calling convention redefinition from 'calling_convention1' to 'calling_convention2' ignored +> calling convention redefinition from 'calling_convention1' to 'calling_convention2' ignored + +## Remarks An attempt to change the calling convention was ignored. -The following sample generates C4440: +## Example + +The following example generates C4440: ```cpp // C4440.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4441.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4441.md index be07663a0d..d4c727635c 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4441.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4441.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4441" title: "Compiler Warning (level 1) C4441" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4441" +ms.date: 11/04/2016 f1_keywords: ["C4441"] helpviewer_keywords: ["C4441"] -ms.assetid: 7fc540a5-e41f-47cf-aa37-b2b699c2685e --- # Compiler Warning (level 1) C4441 -calling convention of 'cc1' ignored; 'cc2' used instead +> calling convention of 'cc1' ignored; 'cc2' used instead + +## Remarks Member functions in managed user-defined types and global function generics must use the [__clrcall](../../cpp/clrcall.md) calling convention. The compiler used `__clrcall`. ## Example -The following sample generates C4441. +The following example generates C4441. ```cpp // C4441.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4445.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4445.md index 4312f592b2..d50740c4fd 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4445.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4445.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4445" title: "Compiler Warning (level 1) C4445" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4445" +ms.date: 11/04/2016 f1_keywords: ["C4445"] helpviewer_keywords: ["C4445"] -ms.assetid: 535e92a0-ba08-4dfc-89b2-af2dcdd7caeb --- # Compiler Warning (level 1) C4445 -'function' : in a WinRT or managed type a virtual method cannot be private +> 'function' : in a WinRT or managed type a virtual method cannot be private + +## Remarks If a virtual function is private, it cannot be accessed by a derived type. To fix this error, change the accessibility of the virtual member function to protected or public. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4412.md b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4412.md index 3ef99e9709..a807242231 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4412.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4412.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 2, off) C4412" title: "Compiler warning (level 2, off) C4412" -ms.date: "1/22/2025" +description: "Learn more about: Compiler Warning (level 2, off) C4412" +ms.date: 1/22/2025 f1_keywords: ["C4412"] helpviewer_keywords: ["C4412"] --- @@ -23,9 +23,9 @@ C4412 is off by default. For more information, see [Compiler Warnings That Are O To resolve this warning, remove all functions from the type. -## Example +## Examples -The following sample generates C4412: +The following example generates C4412: ```cpp // compile with: /c /W2 /clr:pure @@ -50,7 +50,7 @@ int main() { } ``` -The following sample is a header file that declares two types. The `Unsafe` type is unsafe because it has a member function: +The following example is a header file that declares two types. The `Unsafe` type is unsafe because it has a member function: ```cpp // C4412.h @@ -68,7 +68,7 @@ struct Safe { }; ``` -This sample exports functions with the types defined in the header file: +This example exports functions with the types defined in the header file: ```cpp // C4412_2.cpp @@ -85,7 +85,7 @@ __declspec(dllexport) Safe * __cdecl func2() { return new Safe; } The default calling convention in a `/clr:pure` compilation is different from a native compilation. When `C4412.h` is included, `Test` defaults to `__clrcall`. -The following sample generates C4412 and throws an exception at runtime: +The following example generates C4412 and throws an exception at runtime: ```cpp // C4412_3.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4404.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4404.md index 27677fa972..9284eab853 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4404.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4404.md @@ -1,13 +1,14 @@ --- -description: "Learn more about: Compiler Warning (level 3) C4404" title: "Compiler Warning (level 3) C4404" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3) C4404" +ms.date: 11/04/2016 f1_keywords: ["C4404"] helpviewer_keywords: ["C4404"] -ms.assetid: 78ce9985-0ccd-4ec2-92bf-289475109cdd --- # Compiler Warning (level 3) C4404 -period on directive ignored +> period on directive ignored + +## Remarks The optional period preceding the directive is ignored. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4414.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4414.md index 0a4b595c12..e9002be53f 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4414.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4414.md @@ -1,17 +1,20 @@ --- -description: "Learn more about: Compiler Warning (level 3) C4414" title: "Compiler Warning (level 3) C4414" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3) C4414" +ms.date: 11/04/2016 f1_keywords: ["C4414"] helpviewer_keywords: ["C4414"] -ms.assetid: bc81d3ad-55dc-4a6b-a6f2-ec0ef38347df --- # Compiler Warning (level 3) C4414 -'function' : short jump to function converted to near +> 'function' : short jump to function converted to near + +## Remarks Short jumps generate compact instruction which branches to an address within a limited range from the instruction. The instruction includes a short offset that represents the distance between the jump and the target address, the function definition. During linking a function may be moved or subject to link-time optimizations that cause the function to be moved out of the range reachable from a short offset. The compiler must generate a special record for the jump, which requires the jmp instruction to be either NEAR or FAR. The compiler made the conversion. +## Example + For example, the following code generates C4414: ```cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4408.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4408.md index b41f58b75a..80c566c3d8 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4408.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4408.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4408" title: "Compiler Warning (level 4) C4408" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4408" +ms.date: 11/04/2016 f1_keywords: ["C4408"] helpviewer_keywords: ["C4408"] -ms.assetid: 8488a186-ed1d-425c-aaeb-c72472c1da68 --- # Compiler Warning (level 4) C4408 -anonymousstruct or union did not declare any data members +> anonymousstruct or union did not declare any data members + +## Remarks An anonymous struct or union must have at least one data member. -The following sample generates C4408: +## Example + +The following example generates C4408: ```cpp // C4408.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4429.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4429.md index 145ec9b1aa..f4fae6bd4d 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4429.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4429.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4429" title: "Compiler Warning (level 4) C4429" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4429" +ms.date: 11/04/2016 f1_keywords: ["C4429"] helpviewer_keywords: ["C4429"] -ms.assetid: a3e4cf1f-a869-4e47-834a-850c21eb5297 --- # Compiler Warning (level 4) C4429 -possible incomplete or improperly formed universal-character-name +> possible incomplete or improperly formed universal-character-name + +## Remarks The compiler detected a character sequence that may be a badly formed universal character name. A universal character name is `\u` followed by four hex digits, or `\U` followed by eight hex digits. -The following sample generates C4429: +## Example + +The following example generates C4429: ```cpp // C4429.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4431.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4431.md index bba0bbce56..68660c0933 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4431.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4431.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4431" title: "Compiler Warning (level 4) C4431" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4431" +ms.date: 11/04/2016 f1_keywords: ["C4431"] helpviewer_keywords: ["C4431"] -ms.assetid: 58434ab6-dd8d-427b-953a-602fb7453ae6 --- # Compiler Warning (level 4) C4431 -missing type specifier - int assumed. Note: C no longer supports default-int +> missing type specifier - int assumed. Note: C no longer supports default-int + +## Remarks This error can be generated as a result of compiler conformance work that was done for Visual Studio 2005: Visual C++ no longer creates untyped identifiers as int by default. The type of an identifier must be specified explicitly. @@ -16,7 +17,7 @@ This warning is off by default. See [Compiler Warnings That Are Off by Default]( ## Example -The following sample generates C4431. +The following example generates C4431. ```c // C4431.c diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4434.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4434.md index 0315bf031d..6b7e6b52ba 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4434.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4434.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4434" title: "Compiler Warning (level 4) C4434" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4434" +ms.date: 11/04/2016 f1_keywords: ["C4434"] helpviewer_keywords: ["C4434"] -ms.assetid: 24b8785e-353a-4c37-8bed-ed61001a871d --- # Compiler Warning (level 4) C4434 -a class constructor must have private accessibility; changing to private access +> a class constructor must have private accessibility; changing to private access + +## Remarks C4434 indicates that the compiler changed the accessibility of a static constructor. Static constructors must have private accessibility, as they are only meant to be called by the common language runtime. For more information, see [Static constructors](../../dotnet/how-to-define-and-consume-classes-and-structs-cpp-cli.md#BKMK_Static_constructors). ## Example -The following sample generates C4434. +The following example generates C4434. ```cpp // C4434.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4435.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4435.md index 8b30d0111b..aa094d91d2 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4435.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4435.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 4, off) C4435" title: "Compiler Warning (level 4, off) C4435" -ms.date: "1/22/2025" +description: "Learn more about: Compiler Warning (level 4, off) C4435" +ms.date: 1/22/2025 f1_keywords: ["C4435"] helpviewer_keywords: ["C4435"] --- @@ -9,13 +9,15 @@ helpviewer_keywords: ["C4435"] > '*derived_class*': Object layout under `/vd2` will change due to virtual base '*base_class*' +## Remarks + 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). Under the default compile option of `/vd1`, the derived class doesn't have a `vtordisp` field for the indicated virtual base. If `/vd2` or `#pragma vtordisp(2)` is in effect, a `vtordisp` field is present, changing the object layout. This difference can lead to binary compatibility problems if interacting modules are compiled with different `vtordisp` settings. ## Example -The following sample generates C4435. +The following example generates C4435. ```cpp // C4435.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4437.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4437.md index 6a5a36565b..5e09076edc 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4437.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4437.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 1 and level 4, off) C4437" title: "Compiler warning (level 1 and level 4, off) C4437" -ms.date: "1/22/2025" +description: "Learn more about: Compiler Warning (level 1 and level 4, off) C4437" +ms.date: 1/22/2025 f1_keywords: ["C4437"] helpviewer_keywords: ["C4437"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["C4437"] > `dynamic_cast` from virtual base '*base_class*' to '*derived_class*' could fail in some contexts +## Remarks + 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). A `dynamic_cast` operation is used when: @@ -22,7 +24,7 @@ This warning indicates that the `dynamic_cast` might not perform correctly when ## Example -The following sample generates C4437 and demonstrates the code generation issue that arises from the missing `vtordisp` field: +The following example generates C4437 and demonstrates the code generation issue that arises from the missing `vtordisp` field: ```cpp // C4437.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4456.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4456.md index 3860789485..a86eb36dd4 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4456.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4456.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4456" title: "Compiler Warning (level 4) C4456" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4456" +ms.date: 11/04/2016 f1_keywords: ["C4456"] helpviewer_keywords: ["C4456"] -ms.assetid: 5ab39fc1-0e19-461b-842b-4da80560b044 --- # Compiler Warning (level 4) C4456 > declaration of '*identifier*' hides previous local declaration +## Remarks + The declaration of *identifier* in the local scope hides the declaration of the previous local declaration of the same name. This warning lets you know that references to *identifier* in the local scope resolve to the locally declared version, not the previous local, which may or may not be your intent. To fix this issue, we recommend you give local variables names that do not conflict with other local names. ## Example -The following sample generates C4456 because the loop control variable `int x` and the local variable `double x` in `member_fn` have the same names. To fix this issue, use different names for the local variables. +The following example generates C4456 because the loop control variable `int x` and the local variable `double x` in `member_fn` have the same names. To fix this issue, use different names for the local variables. ```cpp // C4456_hide.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4457.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4457.md index af7a117ea6..7f39af8da8 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4457.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4457.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4457" title: "Compiler Warning (level 4) C4457" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4457" +ms.date: 11/04/2016 f1_keywords: ["C4457"] helpviewer_keywords: ["C4457"] -ms.assetid: 02fd149a-917d-4f67-97a6-eb714572271f --- # Compiler Warning (level 4) C4457 > declaration of '*identifier*' hides function parameter +## Remarks + The declaration of *identifier* in the local scope hides the declaration of the identically-named function parameter. This warning lets you know that references to *identifier* in the local scope resolve to the locally declared version, not the parameter, which may or may not be your intent. To fix this issue, we recommend you give local variables names that do not conflict with parameter names. ## Example -The following sample generates C4457 because the parameter `x` and the local variable `x` in `member_fn` have the same names. To fix this issue, use different names for the parameters and local variables. +The following example generates C4457 because the parameter `x` and the local variable `x` in `member_fn` have the same names. To fix this issue, use different names for the parameters and local variables. ```cpp // C4457_hide.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4458.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4458.md index 0aaf058dd0..c1189b04ff 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4458.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4458.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4458" title: "Compiler Warning (level 4) C4458" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4458" +ms.date: 11/04/2016 f1_keywords: ["C4458"] helpviewer_keywords: ["C4458"] -ms.assetid: 7bdaa1b1-0caf-4d68-98c4-6bdd441c23fb --- # Compiler Warning (level 4) C4458 > declaration of '*identifier*' hides class member +## Remarks + The declaration of *identifier* in the local scope hides the declaration of the identically-named *identifier* at class scope. This warning lets you know that references to *identifier* in this scope resolve to the locally declared version, not the class member version, which may or may not be your intent. To fix this issue, we recommend you give local variables names that do not conflict with class member names. ## Example -The following sample generates C4458 because the parameter `x` and the local variable `y` in `member_fn` have the same names as data members in the class. To fix this issue, use different names for the parameters and local variables. +The following example generates C4458 because the parameter `x` and the local variable `y` in `member_fn` have the same names as data members in the class. To fix this issue, use different names for the parameters and local variables. ```cpp // C4458_hide.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4459.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4459.md index ec827f8b2f..417dfe669c 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4459.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4459.md @@ -1,22 +1,23 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4459" title: "Compiler Warning (level 4) C4459" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4459" +ms.date: 11/04/2016 f1_keywords: ["C4459"] helpviewer_keywords: ["C4459"] -ms.assetid: ee9f6287-9c70-4b10-82a0-add82a13997f --- # Compiler Warning (level 4) C4459 > declaration of '*identifier*' hides global declaration +## Remarks + The declaration of *identifier* in the local scope hides the declaration of the identically-named *identifier* in global scope. This warning lets you know that references to *identifier* in this scope resolve to the locally declared version, not the global version, which may or may not be your intent. Generally, we recommend you minimize the use of global variables as a good engineering practice. To minimize pollution of the global namespace, we recommend use of a named namespace for global variables. This warning was new in Visual Studio 2015, in Microsoft C++ compiler version 18.00. To suppress warnings from that version of the compiler or later while migrating your code, use the [/Wv:18](../../build/reference/compiler-option-warning-level.md) compiler option. ## Example -The following sample generates C4459: +The following example generates C4459: ```cpp // C4459_hide.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4460.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4460.md index 6a990f6f67..df25079de5 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4460.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4460.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4460" title: "Compiler Warning (level 4) C4460" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4460" +ms.date: 11/04/2016 f1_keywords: ["C4460"] helpviewer_keywords: ["C4460"] -ms.assetid: c97ac1c9-598d-479e-bfff-c993690c4f3d --- # Compiler Warning (level 4) C4460 -WinRT or CLR operator 'operator', has parameter passed by reference. WinRT or CLR operator 'operator' has different semantics from C++ operator 'operator', did you intend to pass by value? +> WinRT or CLR operator 'operator', has parameter passed by reference. WinRT or CLR operator 'operator' has different semantics from C++ operator 'operator', did you intend to pass by value? + +## Remarks You passed a value by reference to a user-defined Windows Runtime or CLR operator. If the value is changed inside the function, note that the value returned after the function call will be assigned the return value of the function. In standard C++, the changed value is reflected after the function call. ## Example -The following sample generates C4460 and shows how to fix it. +The following example generates C4460 and shows how to fix it. ```cpp // C4460.cpp