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,19 +1,23 @@
---
description: "Learn more about: Compiler Warning (level 1, Error) C4002"
title: "Compiler Warning (level 1, Error) C4002"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1, Error) C4002"
ms.date: 11/04/2016
f1_keywords: ["C4002"]
helpviewer_keywords: ["C4002"]
---
# Compiler Warning (level 1, Error) C4002

> too many arguments for function-like macro invocation '*identifier*'

## Remarks

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.

C4002 can occur when incorrectly using [variadic macros](../../preprocessor/variadic-macros.md).

The following sample generates C4002:
## Examples

The following example generates C4002:

```cpp
// C4002.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1, Error) C4003"
title: "Compiler Warning (level 1, Error) C4003"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1, Error) C4003"
ms.date: 11/04/2016
f1_keywords: ["C4003"]
helpviewer_keywords: ["C4003"]
---
# Compiler Warning (level 1, Error) C4003

> not enough arguments for function-like macro invocation '*identifier*'

## Remarks

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.

The following sample generates C4003:
## Example

The following example generates C4003:

```cpp
// C4003.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
---
description: "Learn more about: Compiler Warning (level 1) C4005"
title: "Compiler Warning (level 1) C4005"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4005"
ms.date: 11/04/2016
f1_keywords: ["C4005"]
helpviewer_keywords: ["C4005"]
ms.assetid: 7f2dc79a-9fcb-4d5b-be61-120d9cb487ad
---
# Compiler Warning (level 1) C4005

'identifier' : macro redefinition
> 'identifier' : macro redefinition

## Remarks

The macro identifier is defined twice. The compiler uses the second macro definition.

Expand All @@ -24,7 +25,9 @@ The macro identifier is defined twice. The compiler uses the second macro defini

1. Use an [#undef](../../preprocessor/hash-undef-directive-c-cpp.md) directive before the second definition.

The following sample generates C4005:
## Example

The following example generates C4005:

```cpp
// C4005.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) C4006"
title: "Compiler Warning (level 1) C4006"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4006"
ms.date: 11/04/2016
f1_keywords: ["C4006"]
helpviewer_keywords: ["C4006"]
ms.assetid: f1a59819-0fd2-4361-8e3a-99e4b514b8e1
---
# Compiler Warning (level 1) C4006

\#undef expected an identifier
> #undef expected an identifier

## Remarks

The `#undef` directive did not specify an identifier to undefine. The directive is ignored. To resolve the warning, be sure to specify an identifier.

## Example

The `#undef` directive did not specify an identifier to undefine. The directive is ignored. To resolve the warning, be sure to specify an identifier. The following sample generates C4006:
The following example generates C4006:

```cpp
// C4006.cpp
Expand Down
Original file line number Diff line number Diff line change
@@ -1,20 +1,23 @@
---
description: "Learn more about: Compiler Warning (level 1) C4010"
title: "Compiler Warning (level 1) C4010"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4010"
ms.date: 11/04/2016
f1_keywords: ["C4010"]
helpviewer_keywords: ["C4010"]
ms.assetid: d607a9ff-8f8f-45c0-b07b-3b2f439e5485
---
# Compiler Warning (level 1) C4010

single-line comment contains line-continuation character
> single-line comment contains line-continuation character

## Remarks

A single-line comment, which is introduced by //, contains a backslash (\\) that serves as a line-continuation character. The compiler considers the next line to be a continuation and treats it as a comment.

Some syntax-directed editors do not indicate the line following the continuation character as a comment. Ignore syntax coloring on any lines that cause this warning.

The following sample generates C4010:
## Example

The following example generates C4010:

```cpp
// C4010.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) C4015"
title: "Compiler Warning (level 1) C4015"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4015"
ms.date: 11/04/2016
f1_keywords: ["C4015"]
helpviewer_keywords: ["C4015"]
ms.assetid: 7242ab90-c869-482f-8152-46728575837e
---
# Compiler Warning (level 1) C4015

'identifier' : type of bit field must be integral
> 'identifier' : type of bit field must be integral

## Remarks

The bit field is not declared as an integer type. The compiler assumes the base type of the bit field to be unsigned. Bit fields must be declared as unsigned integer types.
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
---
description: "Learn more about: Compiler Warning (level 1) C4020"
title: "Compiler Warning (level 1) C4020"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4020"
ms.date: 11/04/2016
f1_keywords: ["C4020"]
helpviewer_keywords: ["C4020"]
ms.assetid: 8c4cd6be-9371-4c8c-b0ff-a5ad367bbab0
---
# Compiler Warning (level 1) C4020

'function' : too many actual parameters
> 'function' : too many actual parameters

## Remarks

The number of actual parameters in a function call exceeds the number of formal parameters in the function prototype or definition. The compiler passes the extra actual parameters according to the calling convention of the function.

The following sample generates C4020:
## Example

The following example generates C4020:

```c
// C4020.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) C4022"
title: "Compiler Warning (level 1) C4022"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4022"
ms.date: 11/04/2016
f1_keywords: ["C4022"]
helpviewer_keywords: ["C4022"]
ms.assetid: 9586ca84-4b40-4602-91a4-2e2415b1ab63
---
# Compiler Warning (level 1) C4022

'function' : pointer mismatch for actual parameter 'number'
> 'function' : pointer mismatch for actual parameter 'number'

## Remarks

The pointer type of the actual parameter differs from the pointer type of the corresponding formal parameter. The actual parameter is passed without change.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4024"
title: "Compiler Warning (level 1) C4024"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4024"
ms.date: 11/04/2016
f1_keywords: ["C4024"]
helpviewer_keywords: ["C4024"]
ms.assetid: f6cb1b70-686a-4747-a01c-de673208209a
---
# Compiler Warning (level 1) C4024

'function' : different types for formal and actual parameter 'number'
> 'function' : different types for formal and actual parameter 'number'

## Remarks

Corresponding formal and actual parameters have different types. The compiler passes the actual parameter without change. The receiving function converts the parameter type to the type expected.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4025"
title: "Compiler Warning (level 1) C4025"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4025"
ms.date: 11/04/2016
f1_keywords: ["C4025"]
helpviewer_keywords: ["C4025"]
ms.assetid: c4f6a651-0641-4446-973e-8290065e49ad
---
# Compiler Warning (level 1) C4025

'number' : based pointer passed to function with variable arguments: parameter number
> 'number' : based pointer passed to function with variable arguments: parameter number

## Remarks

Passing a based pointer to a function with variable arguments causes the pointer to be normalized, with unpredictable results. Do not pass based pointers to functions with variable arguments.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4026"
title: "Compiler Warning (level 1) C4026"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4026"
ms.date: 11/04/2016
f1_keywords: ["C4026"]
helpviewer_keywords: ["C4026"]
ms.assetid: 2c8ff616-8d7f-4784-8037-77f8b6a67698
---
# Compiler Warning (level 1) C4026

function declared with formal parameter list
> function declared with formal parameter list

## Remarks

The function declaration has formal parameters, but the function definition does not. Subsequent calls to this function assume that the function takes no parameters.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
description: "Learn more about compiler warning (level 1) C4027"
title: "Compiler Warning (level 1) C4027"
description: "Learn more about compiler warning (level 1) C4027"
ms.date: 12/16/2020
f1_keywords: ["C4027"]
helpviewer_keywords: ["C4027"]
Expand All @@ -9,6 +9,8 @@ helpviewer_keywords: ["C4027"]

> function declared without formal parameter list

## Remarks

The function declaration had no formal parameters, but there are formal parameters in the function definition or actual parameters in a call.

The compiler accepts, but warns, on an old C-style forward declaration of a function name without a parameter list. On later calls to this function, the compiler assumes that the function takes actual parameters of the types found in the function definition or call. We recommend you modify your function declaration
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@
---
description: "Learn more about: Compiler Warning (level 1) C4028"
title: "Compiler Warning (level 1) C4028"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4028"
ms.date: 11/04/2016
f1_keywords: ["C4028"]
helpviewer_keywords: ["C4028"]
ms.assetid: c3e8b70b-e870-416c-a285-bba5f71dbfc6
---
# Compiler Warning (level 1) C4028

formal parameter 'number' different from declaration
> formal parameter 'number' different from declaration

## Remarks

The type of the formal parameter does not agree with the corresponding parameter in the declaration. The type in the original declaration is used.

This warning is only valid for C source code.

## Example

The following sample generates C4028.
The following example generates C4028.

```c
// C4028.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) C4029"
title: "Compiler Warning (level 1) C4029"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4029"
ms.date: 11/04/2016
f1_keywords: ["C4029"]
helpviewer_keywords: ["C4029"]
ms.assetid: a5c50bab-a189-44c9-aa5c-4377c7c8443a
---
# Compiler Warning (level 1) C4029

declared formal parameter list different from definition
> declared formal parameter list different from definition

## Remarks

Formal parameter types in the function declaration do not agree with those in the function definition. The compiler uses the parameter list from the definition.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4030"
title: "Compiler Warning (level 1) C4030"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4030"
ms.date: 11/04/2016
f1_keywords: ["C4030"]
helpviewer_keywords: ["C4030"]
ms.assetid: 155b290e-4777-4704-ad35-02968b1e4c5e
---
# Compiler Warning (level 1) C4030

**first formal parameter list longer than the second list**
> first formal parameter list longer than the second list

## Remarks

A function was redeclared with different formal parameters. The compiler uses the formal parameters given in the first declaration.
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
---
description: "Learn more about: Compiler Warning (level 1) C4031"
title: "Compiler Warning (level 1) C4031"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4031"
ms.date: 11/04/2016
f1_keywords: ["C4031"]
helpviewer_keywords: ["C4031"]
ms.assetid: 8ac4965d-75e2-42db-9763-3f6ae707e1e1
---
# Compiler Warning (level 1) C4031

second formal parameter list longer than the first list
> second formal parameter list longer than the first list

## Remarks

A function is redeclared with different formal parameters. The compiler uses the formal parameters given in the first declaration.
Original file line number Diff line number Diff line change
@@ -1,22 +1,25 @@
---
description: "Learn more about: Compiler Warning (level 1) C4033"
title: "Compiler Warning (level 1) C4033"
ms.date: "11/04/2016"
description: "Learn more about: Compiler Warning (level 1) C4033"
ms.date: 11/04/2016
f1_keywords: ["C4033"]
helpviewer_keywords: ["C4033"]
ms.assetid: 189a9ec3-ff6d-49dd-b9b2-530b28bbb7c9
---
# Compiler Warning (level 1) C4033

'function' must return a value
> 'function' must return a value

## Remarks

The function does not return a value. An undefined value is returned.

Functions that use **`return`** without a return value must be declared as type **`void`**.

This error is for C language code.

The following sample generates C4033:
## Example

The following example generates C4033:

```c
// C4033.c
Expand Down
Loading