diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4237.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4237.md index 30336fc802..122af02412 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4237.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4237.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4237" title: "Compiler Warning (level 1) C4237" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4237" +ms.date: 11/04/2016 f1_keywords: ["C4237"] helpviewer_keywords: ["C4237"] -ms.assetid: f2e86c4b-80d8-460e-9429-83c5f3f5d7ca --- # Compiler Warning (level 1) C4237 -'keyword' keyword is not yet supported, but reserved for future use +> 'keyword' keyword is not yet supported, but reserved for future use + +## Remarks A keyword in the C++ specification is not implemented in the Microsoft C++ compiler, but the keyword is not available as a user-defined symbol. -The following sample generates C4237: +## Example + +The following example generates C4237: ```cpp // C4237.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4251.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4251.md index 1056b7868c..b0b11764a1 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4251.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4251.md @@ -32,6 +32,8 @@ Think carefully about adding `__declspec(dllexport)` or `__declspec(dllimport)` ## Example +The following example generates C4251: + ```cpp // C4251.cpp // Compile with /std:c++20 /EHsc /W2 /c C4251.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4258.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4258.md index f2131c6a91..a29bd856a5 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4258.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4258.md @@ -1,16 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 1) C4258" title: "Compiler Warning (level 1) C4258" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 1) C4258" +ms.date: 11/04/2016 f1_keywords: ["C4258"] helpviewer_keywords: ["C4258"] -ms.assetid: bbb75e6d-6693-4e62-8ed3-b006a0ec55e3 --- # Compiler Warning (level 1) C4258 -'variable' : definition from the for loop is ignored; the definition from the enclosing scope is used" +> 'variable' : definition from the for loop is ignored; the definition from the enclosing scope is used" + +## Remarks + +Under [/Ze](../../build/reference/za-ze-disable-language-extensions.md) and [/Zc:forScope](../../build/reference/zc-forscope-force-conformance-in-for-loop-scope.md), variables defined in a [for](../../cpp/for-statement-cpp.md) loop go out of scope after the **`for`** loop ends. This warning occurs if a variable with the same name as the loop variable, but defined in the enclosing loop, is used again in the scope containing the **`for`** loop. + +## Example -Under [/Ze](../../build/reference/za-ze-disable-language-extensions.md) and [/Zc:forScope](../../build/reference/zc-forscope-force-conformance-in-for-loop-scope.md), variables defined in a [for](../../cpp/for-statement-cpp.md) loop go out of scope after the **`for`** loop ends. This warning occurs if a variable with the same name as the loop variable, but defined in the enclosing loop, is used again in the scope containing the **`for`** loop. For example: +For example: ```cpp // C4258.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4264.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4264.md index 4fe4000068..a781621f80 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4264.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4264.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 4, off) C4264" title: "Compiler Warning (level 4, off) C4264" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4, off) C4264" +ms.date: 11/04/2016 f1_keywords: ["C4264"] helpviewer_keywords: ["C4264"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["C4264"] > 'virtual_function' : no override available for virtual member function from base 'class'; function is hidden +## Remarks + C4264 is always generated after [C4263](../../error-messages/compiler-warnings/compiler-warning-level-4-c4263.md). 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). diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4269.md b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4269.md index faa8737853..d5b610b759 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4269.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-1-c4269.md @@ -7,12 +7,16 @@ helpviewer_keywords: ["C4269"] --- # Compiler Warning (level 1) C4269 -'identifier' : 'const' automatic data initialized with compiler generated default constructor produces unreliable results +> 'identifier' : 'const' automatic data initialized with compiler generated default constructor produces unreliable results + +## Remarks A **`const`** automatic instance of a non-trivial class is initialized with a compiler-generated default constructor. ## Example +The following example generates C4269: + ```cpp // C4269.cpp // compile with: /c /LD /W1 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4244.md b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4244.md index f1b1594439..e2c76f5572 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4244.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4244.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 2) C4244" title: "Compiler Warning (level 2) C4244" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 2) C4244" +ms.date: 11/04/2016 f1_keywords: ["C4244"] helpviewer_keywords: ["C4244"] -ms.assetid: 2c19d157-21d1-42c2-a6c0-3f30f2ce3813 --- # Compiler Warning (level 2) C4244 -'argument' : conversion from 'type1' to 'type2', possible loss of data +> 'argument' : conversion from 'type1' to 'type2', possible loss of data + +## Remarks A floating point type was converted to an integer type. A possible loss of data may have occurred. @@ -18,7 +19,7 @@ C4244 can also fire at level 3, and 4; see [Compiler Warning (levels 3 and 4) C4 ## Example -The following sample generates C4244: +The following example generates C4244: ```cpp // C4244_level2.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4250.md b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4250.md index 3ec69fa013..b42f61f058 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4250.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-2-c4250.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 2) C4250" title: "Compiler Warning (level 2) C4250" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 2) C4250" +ms.date: 11/04/2016 f1_keywords: ["C4250"] helpviewer_keywords: ["C4250"] -ms.assetid: d47f7249-6b5a-414b-b2d4-56e5d246a782 --- # Compiler Warning (level 2) C4250 -'class1' : inherits 'class2::member' via dominance +> 'class1' : inherits 'class2::member' via dominance + +## Remarks Two or more members have the same name. The one in `class2` is inherited because it is a base class for the other classes that contained this member. @@ -18,6 +19,8 @@ Because a virtual base class is shared among multiple derived classes, a name in ## Examples +The following example generates C4250: + ```cpp // C4250.cpp // compile with: /c /W2 @@ -40,7 +43,7 @@ int main() { } ``` -The following sample generates C4250. +The following example generates C4250. ```cpp // C4250_b.cpp @@ -71,7 +74,7 @@ int main() { } ``` -This sample shows a more complex situation. The following sample generates C4250. +This example shows a more complex situation. The following example generates C4250. ```cpp // C4250_c.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4240.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4240.md index 66fc798b05..529f6f70f3 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4240.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4240.md @@ -1,19 +1,22 @@ --- -description: "Learn more about: Compiler Warning (level 3) C4240" title: "Compiler Warning (level 3) C4240" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3) C4240" +ms.date: 11/04/2016 f1_keywords: ["C4240"] helpviewer_keywords: ["C4240"] -ms.assetid: a2657cdb-18e1-493f-882b-4e10c0bca71d --- # Compiler Warning (level 3) C4240 -nonstandard extension used : access to 'classname' now defined to be 'access specifier', previously it was defined to be 'access specifier' +> nonstandard extension used : access to 'classname' now defined to be 'access specifier', previously it was defined to be 'access specifier' + +## Remarks Under ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), you cannot change the access to a nested class. Under the default Microsoft extensions (/Ze), you can, with this warning. ## Example +The following example generates C4240: + ```cpp // C4240.cpp // compile with: /W3 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4243.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4243.md index 8fab32eef4..6b8dd2c801 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4243.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4243.md @@ -7,11 +7,15 @@ helpviewer_keywords: ["C4243"] --- # Compiler Warning (level 3) C4243 -'conversion type' conversion exists from 'type1' to 'type2', but is inaccessible +> 'conversion type' conversion exists from 'type1' to 'type2', but is inaccessible + +## Remarks A pointer to a derived class is converted to a pointer to a base class, but the derived class inherits the base class with private or protected access. -The following sample generates C4243: +## Example + +The following example generates C4243: ```cpp // C4243.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4265.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4265.md index fa20cef811..7fecde7c7e 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4265.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4265.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 3, off) C4265" title: "Compiler Warning (level 3, off) C4265" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3, off) C4265" +ms.date: 11/04/2016 f1_keywords: ["C4265"] helpviewer_keywords: ["C4265"] --- @@ -9,11 +9,15 @@ helpviewer_keywords: ["C4265"] > '*classname*': class has virtual functions, but its non-trivial destructor is not virtual; instances of this class may not be destructed correctly +## Remarks + When a class has virtual functions but a nonvirtual destructor, objects of the type might not be destroyed properly when the class is destroyed through a base class pointer. 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). -The following sample generates C4265: +## Example + +The following example generates C4265: ```cpp // C4265.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4267.md b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4267.md index bca3c8da4a..3b6989d674 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4267.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-3-c4267.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 3) C4267" title: "Compiler Warning (level 3) C4267" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3) C4267" +ms.date: 11/04/2016 f1_keywords: ["C4267"] helpviewer_keywords: ["C4267"] -ms.assetid: 2fa2f13f-fa4f-47bb-ad8f-6cb19cfc91e6 --- # Compiler Warning (level 3) C4267 -'var' : conversion from 'size_t' to 'type', possible loss of data +> 'var' : conversion from 'size_t' to 'type', possible loss of data + +## Remarks The compiler detected a conversion from `size_t` to a smaller type. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4232.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4232.md index 78d4e5ed20..392aa103b9 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4232.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4232.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4232" title: "Compiler Warning (level 4) C4232" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4232" +ms.date: 11/04/2016 f1_keywords: ["C4232"] helpviewer_keywords: ["C4232"] -ms.assetid: f92028a5-4ddd-43c1-97f5-4f724e5e14af --- # Compiler Warning (level 4) C4232 -nonstandard extension used : 'identifier' : address of dllimport 'dllimport' is not static, identity not guaranteed +> nonstandard extension used : 'identifier' : address of dllimport 'dllimport' is not static, identity not guaranteed + +## Remarks Under Microsoft extensions (/Ze), you can give a nonstatic value as the address of a function declared with the **`dllimport`** modifier. Under ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), this causes an error. -The following sample generates C4232: +## Example + +The following example generates C4232: ```c // C4232.c diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4233.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4233.md index 7987d2e583..0ada63cf90 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4233.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4233.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 1, Error) C4233" title: "Compiler Warning (level 1, Error) C4233" -ms.date: "10/25/2017" +description: "Learn more about: Compiler Warning (level 1, Error) C4233" +ms.date: 10/25/2017 f1_keywords: ["C4233"] helpviewer_keywords: ["C4233"] --- @@ -9,6 +9,8 @@ helpviewer_keywords: ["C4233"] > nonstandard extension used: '*keyword*' keyword only supported in C++, not C +## Remarks + The compiler compiled your source code as C rather than C++, and you used a keyword that is only valid in C++. The compiler compiles your source file as C if the extension of the source file is .c or you use [/Tc](../../build/reference/tc-tp-tc-tp-specify-source-file-type.md). This warning is always issued as an error. Use the [warning](../../preprocessor/warning.md) pragma to disable. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4234.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4234.md index 3b2bc5eacb..65c487e016 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4234.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4234.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4234" title: "Compiler Warning (level 4) C4234" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4234" +ms.date: 11/04/2016 f1_keywords: ["C4234"] helpviewer_keywords: ["C4234"] -ms.assetid: f7fecd5c-8248-4fde-8446-502aedc357ca --- # Compiler Warning (level 4) C4234 -nonstandard extension used: 'keyword' keyword reserved for future use +> nonstandard extension used: 'keyword' keyword reserved for future use + +## Remarks The compiler does not yet implement the keyword you used. diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4238.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4238.md index 679d603ef6..686daa1f66 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4238.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4238.md @@ -1,19 +1,22 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4238" title: "Compiler Warning (level 4) C4238" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4238" +ms.date: 11/04/2016 f1_keywords: ["C4238"] helpviewer_keywords: ["C4238"] -ms.assetid: 5d4051d3-7b0f-43ea-8c8d-d194bfdceb71 --- # Compiler Warning (level 4) C4238 -nonstandard extension used : class rvalue used as lvalue +> nonstandard extension used : class rvalue used as lvalue + +## Remarks For compatibility with previous versions of Visual C++, Microsoft extensions (**/Ze**) allow you to use a class type as an rvalue in a context that implicitly or explicitly takes its address. In some cases, such as the example below, this can be dangerous. ## Example +The following example generates C4238: + ```cpp // C4238.cpp // compile with: /W4 /c diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4239.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4239.md index c68de7e669..ead032c4b0 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4239.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4239.md @@ -1,20 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4239" title: "Compiler Warning (level 4) C4239" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4239" +ms.date: 11/04/2016 f1_keywords: ["C4239"] helpviewer_keywords: ["C4239"] -ms.assetid: a23dc16a-649e-4870-9a24-275de1584fcd --- # Compiler Warning (level 4) C4239 -nonstandard extension used : 'token' : conversion from 'type' to 'type' +> nonstandard extension used : 'token' : conversion from 'type' to 'type' + +## Remarks This type conversion is not allowed by the C++ standard, but it is permitted here as an extension. This warning is always followed by at least one line of explanation describing the language rule being violated. ## Examples -The following sample generates C4239. +The following example generates C4239. ```cpp // C4239.cpp @@ -32,7 +33,7 @@ void func(void) { Conversion from integral type to enum type is not strictly allowed. -The following sample generates C4239. +The following example generates C4239. ```cpp // C4239b.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4242.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4242.md index f0d4ccb106..e122d51b7c 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4242.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4242.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 3, off) C4242" title: "Compiler Warning (level 3, off) C4242" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 3, off) C4242" +ms.date: 11/04/2016 f1_keywords: ["C4242"] helpviewer_keywords: ["C4242"] --- @@ -9,13 +9,17 @@ helpviewer_keywords: ["C4242"] > '*identifier*': conversion from '*type1*' to '*type2*', possible loss of data +## Remarks + The types are different. Type conversion may result in loss of data. The compiler makes the type conversion. 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). For more information on C4242, see [Common Compiler Errors](/windows/win32/WinProg64/common-compiler-errors). -The following sample generates C4242: +## Example + +The following example generates C4242: ```cpp // C4242.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4245.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4245.md index 45dd045a04..051b324035 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4245.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4245.md @@ -1,18 +1,21 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4245" title: "Compiler Warning (level 4) C4245" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4245" +ms.date: 11/04/2016 f1_keywords: ["C4245"] helpviewer_keywords: ["C4245"] -ms.assetid: 85083d53-9cc2-4d12-b58c-6dad28f15cbe --- # Compiler Warning (level 4) C4245 > '*conversion*' : conversion from '*type1*' to '*type2*', signed/unsigned mismatch +## Remarks + You tried to convert a **`signed const`** type that has a negative value to an **`unsigned`** type. -The following sample generates C4245: +## Example + +The following example generates C4245: ```cpp // C4245.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4254.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4254.md index dbcbdcc801..03aa6d9f42 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4254.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4254.md @@ -9,11 +9,15 @@ helpviewer_keywords: ["C4254"] > '*operator*': conversion from '*type1*':'*field_bits*' to '*type2*':'*field_bits*', possible loss of data +## Remarks + A larger bit field was assigned to a smaller bit field. There could be a loss of data. 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). -The following sample generates C4254: +## Example + +The following example generates C4254: ```cpp // C4254.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4255.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4255.md index 4358f2e093..0627f04d95 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4255.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4255.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 4, off) C4255" title: "Compiler Warning (level 4, off) C4255" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4, off) C4255" +ms.date: 11/04/2016 f1_keywords: ["C4255"] helpviewer_keywords: ["C4255"] --- @@ -9,11 +9,15 @@ helpviewer_keywords: ["C4255"] > 'function' : no function prototype given: converting '()' to '(void)' +## Remarks + The compiler didn't find an explicit list of arguments to a function. This warning is for the C compiler only. 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). -The following sample generates C4255: +## Example + +The following example generates C4255: ```c // C4255.c diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4256.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4256.md index 8ce1d40f26..c7a310e4c0 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4256.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4256.md @@ -1,14 +1,15 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4256" title: "Compiler Warning (level 4) C4256" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4256" +ms.date: 11/04/2016 f1_keywords: ["C4256"] helpviewer_keywords: ["C4256"] -ms.assetid: a755a32e-895a-4837-a2b5-4ea06b736798 --- # Compiler Warning (level 4) C4256 -'function' : constructor for class with virtual bases has '...'; calls may not be compatible with older versions of Visual C++ +> 'function' : constructor for class with virtual bases has '...'; calls may not be compatible with older versions of Visual C++ + +## Remarks Possible incompatibility. @@ -20,7 +21,9 @@ To fix this warning, 1. Make sure that all components in their project are built with the current version (including any libraries that may define or reference this class), then disable the warning using the [warning](../../preprocessor/warning.md) pragma. -The following sample generates C4256: +## Example + +The following example generates C4256: ```cpp // C4256.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4263.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4263.md index 7ea2676192..a12a0c9846 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4263.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4263.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 4, off) C4263" title: "Compiler Warning (level 4, off) C4263" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4, off) C4263" +ms.date: 11/04/2016 f1_keywords: ["C4263"] helpviewer_keywords: ["C4263"] --- @@ -9,11 +9,15 @@ helpviewer_keywords: ["C4263"] > 'function' : member function does not override any base class virtual member function +## Remarks + A class function definition has the same name as a virtual function in a base class but not the same number or type of arguments. This pattern effectively hides the virtual function in the base class. 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). -The following sample generates C4263: +## Example + +The following example generates C4263: ```cpp // C4263.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4266.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4266.md index 88e8e554df..9d1dcb0c85 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4266.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4266.md @@ -1,7 +1,7 @@ --- -description: "Learn more about: Compiler Warning (level 4, off) C4266" title: "Compiler Warning (level 4, off) C4266" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4, off) C4266" +ms.date: 11/04/2016 f1_keywords: ["C4266"] helpviewer_keywords: ["C4266"] --- @@ -9,11 +9,15 @@ helpviewer_keywords: ["C4266"] > 'function' : no override available for virtual member function from base 'type'; function is hidden +## Remarks + A derived class didn't override all overloads of a virtual function. 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). -The following sample generates C4266: +## Example + +The following example generates C4266: ```cpp // C4266.cpp diff --git a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4268.md b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4268.md index 7ec668928d..1ec1be3976 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4268.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-level-4-c4268.md @@ -1,19 +1,22 @@ --- -description: "Learn more about: Compiler Warning (level 4) C4268" title: "Compiler Warning (level 4) C4268" -ms.date: "11/04/2016" +description: "Learn more about: Compiler Warning (level 4) C4268" +ms.date: 11/04/2016 f1_keywords: ["C4268"] helpviewer_keywords: ["C4268"] -ms.assetid: d0511e80-904f-4ee1-b4d7-39b5c0bd8234 --- # Compiler Warning (level 4) C4268 -'identifier' : 'const' static/global data initialized with compiler generated default constructor fills the object with zeros +> 'identifier' : 'const' static/global data initialized with compiler generated default constructor fills the object with zeros + +## Remarks A **`const`** global or static instance of a non-trivial class is initialized with a compiler-generated default constructor. ## Example +The following example generates C4268: + ```cpp // C4268.cpp // compile with: /c /LD /W4 diff --git a/docs/error-messages/compiler-warnings/compiler-warning-levels-3-and-4-c4244.md b/docs/error-messages/compiler-warnings/compiler-warning-levels-3-and-4-c4244.md index 75b41ea7dd..68800ee8c0 100644 --- a/docs/error-messages/compiler-warnings/compiler-warning-levels-3-and-4-c4244.md +++ b/docs/error-messages/compiler-warnings/compiler-warning-levels-3-and-4-c4244.md @@ -1,11 +1,13 @@ --- -description: "Learn more about: Compiler Warning (levels 3 and 4) C4244" title: "Compiler Warning (levels 3 and 4) C4244" -ms.date: "11/6/2023" +description: "Learn more about: Compiler Warning (levels 3 and 4) C4244" +ms.date: 11/6/2023 --- # Compiler Warning (levels 3 and 4) C4244 -'conversion' conversion from 'type1' to 'type2', possible loss of data +> 'conversion' conversion from 'type1' to 'type2', possible loss of data + +## Remarks An integer type is converted to a smaller integer type. - This is a level-4 warning if *type1* is a signed or unsigned **`int`** and *type2* is a smaller, such as a signed or unsigned **`short`**. @@ -15,7 +17,9 @@ To fix this warning, either change your program to use compatible types, or add C4244 can also appear when the warning level is 2. For more information, see [Compiler Warning (level 2) C4244](../../error-messages/compiler-warnings/compiler-warning-level-2-c4244.md). -The following sample generates C4244: +## Examples + +The following example generates C4244: ```cpp // C4244_level4.cpp @@ -52,7 +56,7 @@ int main() { Warning C4244 can occur when building code for 64-bit targets that doesn't generate the warning when building for 32-bit targets. For example, pointer arithmetic results in a 32-bit quantity on 32-bit platforms, but a 64-bit quantity on 64-bit platforms. -The following sample generates C4244 when compiled for 64-bit targets: +The following example generates C4244 when compiled for 64-bit targets: ```cpp // C4244_level3_b.cpp