Skip to content

Commit 04d0f95

Browse files
authored
Update compiler-warnings-c4000-through-c4199.md (#5551)
* Learn Editor: Update compiler-warnings-c4000-through-c4199.md * Learn Editor: Update compiler-warnings-c4000-through-c4199.md * Update compiler-warnings-c4000-through-c4199.md * Update toc.yml * Update compiler-warning-level-4-c4001.md * Update compiler-warning-level-1-c4002.md * Update compiler-warning-level-1-c4003.md * Update compiler-warning-level-2-c4007.md * Update compiler-warning-level-1-c4052.md * Update compiler-warning-level-4-c4061.md * Update compiler-warning-level-4-c4061.md * Update compiler-warning-level-4-c4062.md * Update compiler-warning-level-1-c4091.md * Update compiler-warning-level-3-c4101.md * Update compiler-warning-levels-1-and-4-c4112.md * Update compiler-warning-level-3-c4133.md * Update compiler-warning-level-1-c4141.md * Update compiler-warning-level-4-c4189.md * Update compiler-warning-level-3-c4191.md * Update compiler-warning-level-1-c4002.md * Update compiler-warning-level-1-c4002.md * Update compiler-warning-level-1-c4052.md * Update compiler-warning-level-1-c4091.md * Update compiler-warning-level-2-c4007.md * Update compiler-warning-level-3-c4101.md * Update compiler-warning-level-3-c4133.md * Update compiler-warning-level-3-c4191.md * Update compiler-warning-level-4-c4001.md * Update compiler-warning-level-4-c4061.md * Update compiler-warning-level-4-c4062.md * Update compiler-warning-level-4-c4189.md * Update compiler-warning-levels-1-and-4-c4112.md * Update compiler-warning-level-4-c4061.md * Update compiler-warnings-c4000-through-c4199.md
1 parent f139d7e commit 04d0f95

16 files changed

+217
-238
lines changed

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4002.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4002"
3-
title: "Compiler Warning (level 1) C4002"
2+
description: "Learn more about: Compiler Warning (level 1, Error) C4002"
3+
title: "Compiler Warning (level 1, Error) C4002"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4002"]
66
helpviewer_keywords: ["C4002"]
7-
ms.assetid: 6bda1dfe-e2e4-4771-9794-5a404c466dd5
87
---
9-
# Compiler Warning (level 1) C4002
8+
# Compiler Warning (level 1, Error) C4002
109

11-
too many actual parameters for macro 'identifier'
10+
> too many arguments for function-like macro invocation '*identifier*'
1211
1312
The number of actual parameters in the macro exceeds the number of formal parameters in the macro definition. The preprocessor collects the extra parameters but ignores them during macro expansion.
1413

15-
C4002 can occur when incorrectly using [Variadic Macros](../../preprocessor/variadic-macros.md).
14+
C4002 can occur when incorrectly using [variadic macros](../../preprocessor/variadic-macros.md).
1615

1716
The following sample generates C4002:
1817

@@ -32,7 +31,7 @@ int main() {
3231

3332
This error can also be generated as a result of compiler conformance work that was done for Visual Studio .NET 2003: extra commas in macro no longer accepted.
3433

35-
The compiler will no longer accept extra commas in a macro. For code to be valid in both the Visual Studio .NET 2003 and Visual Studio .NET versions of Visual C++, remove the extra commas.
34+
The compiler no longer accepts extra commas in a macro. For code to be valid in both the Visual Studio .NET 2003 and Visual Studio .NET versions of Visual C++, remove the extra commas.
3635

3736
```cpp
3837
// C4002b.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4003.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4003"
3-
title: "Compiler Warning (level 1) C4003"
2+
description: "Learn more about: Compiler Warning (level 1, Error) C4003"
3+
title: "Compiler Warning (level 1, Error) C4003"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4003"]
66
helpviewer_keywords: ["C4003"]
7-
ms.assetid: 0ed1c285-4428-4c90-8131-86897e31f115
87
---
9-
# Compiler Warning (level 1) C4003
8+
# Compiler Warning (level 1, Error) C4003
109

11-
not enough actual parameters for macro 'identifier'
10+
> not enough arguments for function-like macro invocation '*identifier*'
1211
1312
The number of formal parameters in the macro definition exceeds the number of actual parameters in the macro. Macro expansion substitutes empty text for the missing parameters.
1413

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4052.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4052"
3-
title: "Compiler Warning (level 1) C4052"
2+
description: "Learn more about: Compiler Warning (level 1 and level 4) C4052"
3+
title: "Compiler Warning (level 1 and level 4) C4052"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4052"]
66
helpviewer_keywords: ["C4052"]
7-
ms.assetid: f9955421-16ab-46e5-8f9d-bf1639a519ef
87
---
9-
# Compiler Warning (level 1) C4052
8+
# Compiler Warning (level 1 and level 4) C4052
109

11-
function declarations different; one contains variable arguments
10+
> function declarations different; one contains variable arguments
1211
13-
One declaration of the function does not contain variable arguments. It is ignored.
12+
One declaration of the function doesn't contain variable arguments. The empty declaration is ignored.
1413

1514
The following sample generates C4052:
1615

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4091.md

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4091"
3-
title: "Compiler Warning (level 1) C4091"
2+
description: "Learn more about: Compiler Warning (level 1 and level 2) C4091"
3+
title: "Compiler Warning (level 1 and level 2) C4091"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4091"]
66
helpviewer_keywords: ["C4091"]
7-
ms.assetid: 3a404967-ab42-49b0-b324-fd7ba1859d78
87
---
9-
# Compiler Warning (level 1) C4091
8+
# Compiler Warning (level 1 and level 2) C4091
109

11-
'keyword' : ignored on left of 'type' when no variable is declared
10+
> '*keyword*': ignored on left of '*type*' when no variable is declared
1211
13-
The compiler detected a situation where the user probably intended a variable to be declared, but the compiler was not able to declare the variable.
12+
The compiler detected a situation where the user probably intended a variable to be declared, but the compiler wasn't able to declare the variable.
1413

1514
## Examples
1615

@@ -29,7 +28,7 @@ __declspec(dllimport) class X2 {} varX;
2928
class __declspec(dllimport) X3 {};
3029
```
3130
32-
If an identifier is a typedef, it cannot also be a variable name. The following sample generates C4091.
31+
If an identifier is a typedef, it can't also be a variable name. The following sample generates C4091.
3332
3433
```cpp
3534
// C4091_b.cpp

docs/error-messages/compiler-warnings/compiler-warning-level-1-c4141.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 1) C4141"
3-
title: "Compiler Warning (level 1) C4141"
2+
description: "Learn more about: Compiler Warning (level 1, Error) C4141"
3+
title: "Compiler Warning (level 1, Error) C4141"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4141"]
66
helpviewer_keywords: ["C4141"]
7-
ms.assetid: 6ce8c058-7f4c-41cf-93e7-90a466744656
87
---
9-
# Compiler Warning (level 1) C4141
8+
# Compiler Warning (level 1, Error) C4141
109

11-
'modifier' : used more than once
10+
> '*modifier*': used more than once
1211
1312
## Example
1413

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 2) C4007"
3-
title: "Compiler Warning (level 2) C4007"
2+
description: "Learn more about: Compiler Warning (level 3) C4007"
3+
title: "Compiler Warning (level 3) C4007"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4007"]
66
helpviewer_keywords: ["C4007"]
7-
ms.assetid: 56a70c07-59a5-4fd7-80ed-63592c65cbb7
87
---
9-
# Compiler Warning (level 2) C4007
8+
# Compiler Warning (level 3) C4007
109

11-
'function' : must be 'attribute'
10+
> '*function*': must be '*attribute*'
1211
13-
A required attribute for a function is not explicitly stated. For example, the function **main** must have the **`__cdecl`** attribute. The compiler forces the attribute.
12+
A required attribute for a function isn't explicitly stated. For example, the function `main` must have the `__cdecl` attribute. The compiler forces the attribute.

docs/error-messages/compiler-warnings/compiler-warning-level-3-c4101.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,15 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 3) C4101"
3-
title: "Compiler Warning (level 3) C4101"
2+
description: "Learn more about: Compiler Warning (level 3 and level 4) C4101"
3+
title: "Compiler Warning (level 3 and level 4) C4101"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4101"]
66
helpviewer_keywords: ["C4101"]
7-
ms.assetid: d98563cd-9dce-4aae-8f12-bd552a4ea677
87
---
9-
# Compiler Warning (level 3) C4101
8+
# Compiler Warning (level 3 and level 4) C4101
109

11-
'identifier' : unreferenced local variable
10+
> '*identifier*': unreferenced local variable
1211
13-
The local variable is never used. This warning will occur in the obvious situation:
12+
The local variable is never used. This warning occurs in the obvious situation:
1413

1514
```cpp
1615
// C4101a.cpp
@@ -20,7 +19,7 @@ int i; // C4101
2019
}
2120
```
2221

23-
However, this warning will also occur when calling a **`static`** member function through an instance of the class:
22+
However, this warning also occurs when calling a **`static`** member function through an instance of the class:
2423

2524
```cpp
2625
// C4101b.cpp
@@ -39,7 +38,7 @@ int main() {
3938
}
4039
```
4140
42-
In this situation, the compiler uses information about `si` to access the **`static`** function, but the instance of the class is not needed to call the **`static`** function; hence the warning. To resolve this warning, you could:
41+
In this situation, the compiler uses information about `si` to access the **`static`** function, but the instance of the class isn't needed to call the **`static`** function; hence the warning. To resolve this warning, you could:
4342
4443
- Add a constructor, in which the compiler would use the instance of `si` in the call to `func`.
4544
Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,14 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 3) C4133"
3-
title: "Compiler Warning (level 3) C4133"
2+
description: "Learn more about: Compiler Warning (level 1 and level 3) C4133"
3+
title: "Compiler Warning (level 1 and level 3) C4133"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4133"]
66
helpviewer_keywords: ["C4133"]
7-
ms.assetid: bdef87b0-21b3-41ac-9b23-1fa86101a9ac
87
---
9-
# Compiler Warning (level 3) C4133
8+
# Compiler Warning (level 1 and level 3) C4133
109

11-
'type' : incompatible types - from 'type1' to 'type2'
10+
> '*expression*': incompatible types - from '*type1*' to '*type2*'
1211
13-
This warning can be caused by trying to subtract two pointers of different types.
12+
This warning is emitted when incompatible types are used in an expression. For example, doing arithmetic operations such as subtraction with different pointer types.
1413

1514
To avoid this warning, provide an appropriate type cast.

docs/error-messages/compiler-warnings/compiler-warning-level-3-c4191.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 3) C4191"
3-
title: "Compiler Warning (level 3) C4191"
2+
description: "Learn more about: Compiler Warning (level 3, off) C4191"
3+
title: "Compiler Warning (level 3, off) C4191"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4191"]
66
helpviewer_keywords: ["C4191"]
7-
ms.assetid: 576d3bc6-95b7-448a-af31-5d798452df09
87
---
9-
# Compiler Warning (level 3) C4191
8+
# Compiler Warning (level 3, off) C4191
109

11-
'operator/operation' : unsafe conversion from 'type of expression' to 'type required'
10+
> '*operation*': unsafe conversion from '*type_of_expression*' to '*type_required*'<br/>Making a function call using the resulting pointer may cause your program to fail
1211
1312
Several operations involving function pointers are considered unsafe:
1413

@@ -18,15 +17,15 @@ Several operations involving function pointers are considered unsafe:
1817

1918
- Argument or return types with different sizes, type categories, or classifications.
2019

21-
- Differing argument list lengths (on **`__cdecl`**, only on cast from longer list to shorter list, even if shorter is varargs).
20+
- Different argument list lengths (on **`__cdecl`**, only on cast from longer list to shorter list, even if shorter is varargs).
2221

23-
- Pointer to data (other than **`void`**<strong>\*</strong>) aliased against a pointer to function.
22+
- Pointer to data (other than **`void*`**) aliased against a pointer to function.
2423

2524
- Any other type difference that would yield an error or warning on a **`reinterpret_cast`**.
2625

2726
Calling this function through the result pointer might cause your program to crash.
2827

29-
This warning is off by default. See [Compiler Warnings That Are Off by Default](../../preprocessor/compiler-warnings-that-are-off-by-default.md) for more information.
28+
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).
3029

3130
The following sample generates C4191:
3231

docs/error-messages/compiler-warnings/compiler-warning-level-4-c4001.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,19 @@
11
---
2-
description: "Learn more about: Compiler Warning (level 4) C4001"
3-
title: "Compiler Warning (level 4) C4001"
2+
description: "Learn more about: Compiler Warning (level 4, no longer emitted) C4001"
3+
title: "Compiler Warning (level 4, no longer emitted) C4001"
44
ms.date: "11/04/2016"
55
f1_keywords: ["C4001"]
66
helpviewer_keywords: ["C4001"]
7-
ms.assetid: 414a47fe-d597-425e-9374-6a569231dc0a
87
---
9-
# Compiler Warning (level 4) C4001
8+
# Compiler Warning (level 4, no longer emitted) C4001
109

11-
nonstandard extension 'single line comment' was used
10+
> nonstandard extension 'single line comment' was used
1211
1312
> [!NOTE]
1413
> This warning is removed in Visual Studio 2017 version 15.5 because single-line comments are standard in C99.
1514
1615
Single-line comments are standard in C++ and standard in C starting with C99.
17-
Under strict ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), C files that contain single-line comments, generate C4001 due to the usage of a nonstandard extension. Since single-line comments are standard in C++, C files containing single-line comments do not produce C4001 when compiling with Microsoft extensions (/Ze).
16+
Under strict ANSI compatibility ([/Za](../../build/reference/za-ze-disable-language-extensions.md)), C files that contain single-line comments, generate C4001 due to the usage of a nonstandard extension. Since single-line comments are standard in C++, C files containing single-line comments don't produce C4001 when compiling with Microsoft extensions (/Ze).
1817

1918
## Example
2019

0 commit comments

Comments
 (0)