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,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (level 1) C4122"
title: "Compiler Warning (level 1) C4122"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4122"
ms.date: 11/04/2016
f1_keywords: ["C4122"]
helpviewer_keywords: ["C4122"]
ms.assetid: 9a83eb0d-8708-42f7-988a-b0b6f2f646a0
---
# Compiler Warning (level 1) C4122

'function' : alloc_text applicable only to functions with C linkage
> 'function' : alloc_text applicable only to functions with C linkage

## Remarks

The **alloc_text** pragma applies only to functions declared with **extern c**. It cannot be used with external C++ functions.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (level 1) C4124"
title: "Compiler Warning (level 1) C4124"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4124"
ms.date: 11/04/2016
f1_keywords: ["C4124"]
helpviewer_keywords: ["C4124"]
ms.assetid: c08c3a65-9584-47a1-a147-44f00c4b230e
---
# Compiler Warning (level 1) C4124

__fastcall with stack checking is inefficient
> __fastcall with stack checking is inefficient

## Remarks

The **`__fastcall`** keyword was used with stack checking enabled.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
---
description: "Learn more about: Compiler Warning (level 1) C4129"
title: "Compiler Warning (level 1) C4129"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4129"
ms.date: 11/04/2016
f1_keywords: ["C4129"]
helpviewer_keywords: ["C4129"]
ms.assetid: a4190c64-4bfb-48fd-8e98-52720bc0d878
---
# Compiler Warning (level 1) C4129

'character' : unrecognized character escape sequence
> 'character' : unrecognized character escape sequence

## Remarks

The `character` following a backslash (\\) in a character or string constant is not recognized as a valid escape sequence. The backslash is ignored and not printed. The character following the backslash is printed.

To print a single backslash, specify a double backslash (\\\\).

The C++ standard, in section 2.13.2 discusses escape sequences.

The following sample generates C4129:
## Example

The following example generates C4129:

```cpp
// C4129.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
description: "Learn more about: Compiler Warning (level 1) C4138"
title: "Compiler Warning (level 1) C4138"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4138"
ms.date: 11/04/2016
f1_keywords: ["C4138"]
helpviewer_keywords: ["C4138"]
ms.assetid: 65ebf929-bba0-4237-923b-c1b66adfe17d
---
# Compiler Warning (level 1) C4138

'*/' found outside of comment
> '*/' found outside of comment

## Remarks

The closing-comment delimiter is not preceded by an opening-comment delimiter. The compiler assumes a space between the asterisk (<strong>\*</strong>) and the forward slash (/).

## Example

The following example generates C4138:

```cpp
// C4138a.cpp
// compile with: /W1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
description: "Learn more about: Compiler Warning (level 1, Error) C4141"
title: "Compiler Warning (level 1, Error) C4141"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1, Error) C4141"
ms.date: 11/04/2016
f1_keywords: ["C4141"]
helpviewer_keywords: ["C4141"]
---
Expand All @@ -11,6 +11,8 @@ helpviewer_keywords: ["C4141"]

## Example

The following example generates C4141:

```cpp
// C4141.cpp
// compile with: /W1 /LD
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (level 1) C4142"
title: "Compiler Warning (level 1) C4142"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4142"
ms.date: 11/04/2016
f1_keywords: ["C4142"]
helpviewer_keywords: ["C4142"]
ms.assetid: 1fdfc3dc-60a2-4f00-b133-20e400f9b7a6
---
# Compiler Warning (level 1) C4142

benign redefinition of type
> benign redefinition of type

## Remarks

A type is redefined in a manner that has no effect on the generated code.

Expand All @@ -18,7 +19,9 @@ To fix by checking the following possible causes:

- A type defined with the **`typedef`** command is redefined using different syntax.

The following sample generates C4142:
## Example

The following example generates C4142:

```c
// C4142.c
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4143"
title: "Compiler Warning (level 1) C4143"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4143"
ms.date: 11/04/2016
f1_keywords: ["C4143"]
helpviewer_keywords: ["same_seg", "C4143"]
ms.assetid: ef0bd19f-d169-4034-8710-b22971bd642d
---
# Compiler Warning (level 1) C4143

pragma 'same_seg' not supported; use __based allocation
> pragma 'same_seg' not supported; use __based allocation

## Remarks

The **#pragma same_seg** is no longer supported. Use the [__based](../../cpp/based-pointers-cpp.md) keyword instead.
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4144"
title: "Compiler Warning (level 1) C4144"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4144"
ms.date: 11/04/2016
f1_keywords: ["C4144"]
helpviewer_keywords: ["C4144"]
ms.assetid: a37b445d-dbc6-43b4-8d95-ffd0e4225464
---
# Compiler Warning (level 1) C4144

'expression' : relational expression as switch expression
> 'expression' : relational expression as switch expression

## Remarks

The specified relational expression was used as the control expression of a [switch](../../cpp/switch-statement-cpp.md) statement. The associated case statements will be offered Boolean values.

## Example

The specified relational expression was used as the control expression of a [switch](../../cpp/switch-statement-cpp.md) statement. The associated case statements will be offered Boolean values. The following sample generates C4144:
The following example generates C4144:

```cpp
// C4144.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4145"
title: "Compiler Warning (level 1) C4145"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4145"
ms.date: 11/04/2016
f1_keywords: ["C4145"]
helpviewer_keywords: ["C4145"]
ms.assetid: 0440777a-cca2-4159-aff5-e67a254ad64a
---
# Compiler Warning (level 1) C4145

'expression1' : relational expression as switch expression; possible confusion with 'expression2'
> 'expression1' : relational expression as switch expression; possible confusion with 'expression2'

## Remarks

A **`switch`** statement uses a relational expression as its control expression, which results in a Boolean value for the **`case`** statements. Did you mean *expression2*?

## Example

The following sample generates C4145:
The following example generates C4145:

```cpp
// C4145.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4153"
title: "Compiler Warning (level 1) C4153"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4153"
ms.date: 11/04/2016
f1_keywords: ["C4153"]
helpviewer_keywords: ["C4153"]
ms.assetid: 37a15754-9dba-470b-adda-c4b888064b3e
---
# Compiler Warning (level 1) C4153

function/data pointer conversion in expression
> function/data pointer conversion in expression

## Remarks

A function pointer is converted to or from a data pointer. This conversion is allowed under Microsoft extensions (/Ze) but not under ANSI C.
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
---
description: "Learn more about: Compiler Warning (level 1) C4154"
title: "Compiler Warning (level 1) C4154"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4154"
ms.date: 11/04/2016
f1_keywords: ["C4154"]
helpviewer_keywords: ["C4154"]
ms.assetid: 4511afeb-e893-4cc6-83b6-4c7a0477f76b
---
# Compiler Warning (level 1) C4154

deletion of an array expression; conversion to pointer supplied
> deletion of an array expression; conversion to pointer supplied

## Remarks

You cannot use **`delete`** on an array, so the compiler converts the array to a pointer.

## Example

The following example generates C4154:

```cpp
// C4154.cpp
// compile with: /c /W1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4155"
title: "Compiler Warning (level 1) C4155"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4155"
ms.date: 11/04/2016
f1_keywords: ["C4155"]
helpviewer_keywords: ["C4155"]
ms.assetid: ba233353-09e3-4195-8127-13a27ddd8d70
---
# Compiler Warning (level 1) C4155

deletion of an array expression without using the array form of 'delete'
> deletion of an array expression without using the array form of 'delete'

## Remarks

The array form of **`delete`** should be used to delete an array. This warning occurs only under ANSI-compatibility (/Za).

## Example

The following sample generates C4155:
The following example generates C4155:

```cpp
// C4155.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4157"
title: "Compiler Warning (level 1) C4157"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4157"
ms.date: 11/04/2016
f1_keywords: ["C4157"]
helpviewer_keywords: ["C4157"]
ms.assetid: 6dabc303-eba1-4a8e-a124-a6e1dc84f4bd
---
# Compiler Warning (level 1) C4157

pragma was ignored by C compiler
> pragma was ignored by C compiler

## Remarks

Only the C++ compiler recognizes **init_seg()**.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4158"
title: "Compiler Warning (level 1) C4158"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4158"
ms.date: 11/04/2016
f1_keywords: ["C4158"]
helpviewer_keywords: ["C4158"]
ms.assetid: 6513c6b9-6772-4849-b96c-5bb093d54de6
---
# Compiler Warning (level 1) C4158

> assuming #pragma pointers_to_members(full_generality, inheritance)

## Remarks

A `#pragma pointers_to_members( single | multiple | virtual )` was issued without an accompanying `#pragma pointers_to_members(full_generality)`.
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
description: "Learn more about: Compiler Warning (level 1) C4160"
title: "Compiler Warning (level 1) C4160"
ms.date: "08/27/2018"
description: "Learn more about: Compiler Warning (level 1) C4160"
ms.date: 08/27/2018
f1_keywords: ["C4160"]
helpviewer_keywords: ["C4160"]
ms.assetid: a9610cb7-cac4-4a74-8b4e-049030ebb92b
---
# Compiler Warning (level 1) C4160

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: "Learn more about: Compiler warning (level 2) C4146"
title: "Compiler warning (level 2) C4146"
description: "Learn more about: Compiler warning (level 2) C4146"
ms.date: 04/22/2025
f1_keywords: ["C4146"]
helpviewer_keywords: ["C4146"]
Expand All @@ -9,10 +9,10 @@ helpviewer_keywords: ["C4146"]

> unary minus operator applied to unsigned type, result still unsigned

Unsigned types only hold non-negative values. So unary minus (negation) usually doesn't make sense when applied to an unsigned type. Both the operand and the result are non-negative.

## Remarks

Unsigned types only hold non-negative values. So unary minus (negation) usually doesn't make sense when applied to an unsigned type. Both the operand and the result are non-negative.

When you express a negative integer literal, the **`-`** in front of the value is parsed as a [unary negation](../../cpp/unary-plus-and-negation-operators-plus-and.md) operator. The compiler applies the operator after it parses the numeric value. If the numeric value fits in the range of an unsigned integer type, but not the corresponding signed integer type, the compiler interprets the value as unsigned.

This warning often occurs when you try to express the minimum **`int`** value, -2147483648, or the minimum **`long long`** value, -9223372036854775808. These values can't be written as -2147483648 or -9223372036854775808ll. The reason is because the compiler processes the expression in two stages: first, it parses the numeric value, then it applies the negation operator. For example, when the compiler parses -2147483648, it follows these steps:
Expand All @@ -28,7 +28,7 @@ The [`/sdl` (Enable Additional Security Checks)](../../build/reference/sdl-enabl

## Example

The following sample demonstrates the unexpected behavior that can happen when the compiler generates warning C4146:
The following example demonstrates the unexpected behavior that can happen when the compiler generates warning C4146:

```cpp
// C4146.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
title: Compiler warning (level 2) C4150
title: "Compiler warning (level 2) C4150"
description: "Learn more about: Compiler Warning (level 2) C4150"
ms.date: 11/04/2016
f1_keywords: ["C4150"]
Expand All @@ -9,11 +9,13 @@ helpviewer_keywords: ["C4150"]

> deletion of pointer to incomplete type 'type'; no destructor called

## Remarks

The `delete` operator is called to delete a type that was declared but not defined. The compiler can't find the destructor to call because the definition isn't in the same translation unit as the `delete`.

## Example

The following sample generates C4150 by declaring but not defining `class IncClass`:
The following example generates C4150 by declaring but not defining `class IncClass`:

```cpp
// compile with: /W2
Expand Down
Loading