File tree Expand file tree Collapse file tree 1 file changed +8
-9
lines changed
docs/error-messages/compiler-warnings Expand file tree Collapse file tree 1 file changed +8
-9
lines changed Original file line number Diff line number Diff line change 1
1
---
2
2
description : " Learn more about: Compiler Warning (level 1) C4178"
3
3
title : " Compiler Warning (level 1) C4178"
4
- ms.date : " 11/04/2016 "
4
+ ms.date : " 03/06/2024 "
5
5
f1_keywords : ["C4178"]
6
6
helpviewer_keywords : ["C4178"]
7
- ms.assetid : 2c2c8f97-a5c4-47cd-8dd2-beea172613f3
8
7
---
9
8
# Compiler Warning (level 1) C4178
10
9
@@ -16,16 +15,16 @@ A case constant in a **`switch`** expression does not fit in the type to which i
16
15
17
16
``` cpp
18
17
// C4178.cpp
19
- // compile with: /W1
18
+ // compile with: /W1 /permissive
20
19
int main ()
21
20
{
22
- int i; // maximum size of unsigned long int is 4294967295
23
- switch( i )
21
+ unsigned int u = 1;
22
+ switch (u )
24
23
{
25
- case 4294967295: // OK
26
- break;
27
- case 4294967296: // C4178
28
- break;
24
+ case 4294967295: // OK, maximum value for type unsigned int
25
+ break;
26
+ case 4294967296: // C4178, exceeded maximum value
27
+ break;
29
28
}
30
29
}
31
30
```
You can’t perform that action at this time.
0 commit comments