Skip to content

Commit 1d15840

Browse files
Updated C28208
Updated to new format, added more information, added an example
1 parent 8581294 commit 1d15840

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

docs/code-quality/c28208.md

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,42 @@
11
---
22
description: "Learn more about: C28208"
33
title: C28208
4-
ms.date: 11/04/2016
4+
ms.date: 08/30/2022
55
ms.topic: reference
6-
f1_keywords: ["C28208"]
6+
f1_keywords: ["C28208", "FUNCTION_TYPE_REDECLARATION", "__WARNING_FUNCTION_TYPE_REDECLARATION"]
77
helpviewer_keywords: ["C28208"]
88
ms.assetid: e9a8ce37-3b05-4202-b078-5570ae496d1d
99
---
10-
# C28208
10+
# Warning C28208
1111

12-
> warning C28208: Function \<function> was previously defined with a different parameter list at \<file>(\<line>). Some analysis tools will yield incorrect results
12+
> Function `\**function_name*` was previously defined with a different parameter list at `\**file_name*`(`\**line_number*`). Some analysis tools will yield incorrect results
1313
14-
This warning is reported when a function's known definition doesn't match another occurrence.
14+
## Remarks
15+
16+
This warning will almost always accompany [Compiler Warning (level 1) C4028](/cpp/error-messages/compiler-warnings/compiler-warning-level-1-c4028?view=msvc-170). Both warn of a mismatch between the parameters of a function's declaration and its definition. However, this specific error indicates a more niche case than C4028. C28208 indicates not only that a mismatch exists, but that it also can cause issues with analysis tools. This warning most notably occurs when the mismatch exists between a `typedef` function pointer and the definition of that function. This is demonstrated in the example below.
17+
18+
Code analysis name: FUNCTION_TYPE_REDECLARATION
19+
20+
## Example
21+
22+
The following code will generate C28208. `test_type` takes in a void pointer in its declaration, but `my_test1` takes in an integer pointer instead. `my_test2` remediates this issue by making sure the definition parameter match the declaration parameters.
23+
24+
*From example.h:*
25+
26+
```cpp
27+
typedef void test_type(void*);
28+
```
29+
30+
*From example.cpp:*
31+
32+
```cpp
33+
test_type my_test1;
34+
test_type my_test2;
35+
void my_test1(int* x){}; // Will generate C28208
36+
void my_test2(void* x){}; // Will not generate C28208
37+
38+
int main()
39+
{
40+
// Code
41+
}
42+
```

0 commit comments

Comments
 (0)