File tree Expand file tree Collapse file tree 3 files changed +49
-29
lines changed
docs/error-messages/compiler-warnings Expand file tree Collapse file tree 3 files changed +49
-29
lines changed Original file line number Diff line number Diff line change 3737## [ Compiler Warning (level 2) C4051] ( compiler-warning-level-2-c4051.md )
3838## [ Compiler Warning (level 1) C4052] ( compiler-warning-level-1-c4052.md )
3939## [ Compiler Warning (level 4) C4053] ( compiler-warning-level-4-c4053.md )
40+ ## [ Compiler warning (level 1) C4055] ( compiler-warning-level-1-c4055.md )
4041## [ Compiler Warning (level 2) C4056] ( compiler-warning-level-2-c4056.md )
4142## [ Compiler Warning (level 4) C4057] ( compiler-warning-level-4-c4057.md )
4243## [ Compiler Warning (level 4) C4061] ( compiler-warning-level-4-c4061.md )
Original file line number Diff line number Diff line change 1- # Compiler Warning (level 1) C4055
2-
3- 'conversion' : from data pointer 'type1' to function pointer 'type2'
4-
1+ ---
2+ title : " Compiler Warning (level 1) C4052 | Microsoft Docs"
3+ ms.custom : " "
4+ ms.date : " 11/04/2016"
5+ ms.technology : ["cpp-tools"]
6+ ms.topic : " reference"
7+ f1_keywords : ["C4055"]
8+ dev_langs : ["C++"]
9+ helpviewer_keywords : ["C4055"]
10+ ms.assetid : f9955421-16ab-46e5-8f9d-bf1639a519ef
11+ author : " corob-msft"
12+ ms.author : " corob"
13+ ms.workload : ["cplusplus"]
14+ ---
15+ # Compiler Warning (level 1) C4055
16+
17+ > '* conversion* ' : from data pointer '* type1* ' to function pointer '* type2* '
18+
19+ ## Remarks
20+
521** Obsolete:** This warning is not generated by Visual Studio 2017 and later versions.
622
7- A data pointer is cast (possibly incorrectly) to a function pointer. This is a level 1 warning under /Za and a level 4 warning under /Ze.
8-
9- The following sample generates C4055:
10-
11- ``` C
12- // C4055.c
13- // compile with: /Za /W1 /c
14- typedef int (* PFUNC)();
15- int * pi;
16- PFUNC f() {
17- return (PFUNC)pi; // C4055
18- }
19- ```
20-
21- Under /Ze, this is a level 4 warning.
22-
23- ```C
24- // C4055b.c
25- // compile with: /W4 /c
26- typedef int (*PFUNC)();
27- int *pi;
28- PFUNC f() {
29- return (PFUNC)pi; // C4055
30- }
31- ```
23+ A data pointer is cast (possibly incorrectly) to a function pointer. This is a level 1 warning under /Za and a level 4 warning under /Ze.
24+
25+ ## Example
26+
27+ The following sample generates C4055:
28+
29+ ``` C
30+ // C4055.c
31+ // compile with: /Za /W1 /c
32+ typedef int (* PFUNC)();
33+ int * pi;
34+ PFUNC f() {
35+ return (PFUNC)pi; // C4055
36+ }
37+ ```
38+
39+ Under /Ze, this is a level 4 warning.
40+
41+ ```C
42+ // C4055b.c
43+ // compile with: /W4 /c
44+ typedef int (*PFUNC)();
45+ int *pi;
46+ PFUNC f() {
47+ return (PFUNC)pi; // C4055
48+ }
49+ ```
Original file line number Diff line number Diff line change @@ -65,6 +65,7 @@ The articles in this section of the documentation explain a subset of the warnin
6565| Compiler warning (level 1) C4051| type conversion; possible loss of data|
6666| Compiler warning (level 4) C4052| function declarations different; one contains variable arguments|
6767| Compiler warning (level 4) C4053| one void operand for '?:'|
68+ | [ Compiler warning (level 1) C4055] ( compiler-warning-level-1-c4055.md ) | 'conversion' : from data pointer '* type1* ' to function pointer '* type2* '|
6869| [ Compiler Warning (level 2) C4056] ( ../../error-messages/compiler-warnings/compiler-warning-level-2-c4056.md ) | overflow in floating-point constant arithmetic|
6970| Compiler warning (level 4) C4057| 'operator': 'identifier1' differs in indirection to slightly different base types from 'identifier2'|
7071| Compiler warning C4060| switch statement contains no 'case' or 'default' labels|
You can’t perform that action at this time.
0 commit comments