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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
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"]
---
# Compiler Warning (level 4, off) 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).
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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
Expand All @@ -40,7 +43,7 @@ int main() {
}
```

The following sample generates C4250.
The following example generates C4250.

```cpp
// C4250_b.cpp
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,23 @@
---
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"]
---
# Compiler Warning (level 3, off) 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
Expand Down
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
---
description: "Learn more about: Compiler Warning (level 1, Error) 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"]
---
# Compiler Warning (level 1, Error) 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.
Original file line number Diff line number Diff line change
@@ -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.

Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down
Loading