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 11---
22description : " Learn more about: Compiler Warning (level 1) C4178"
33title : " Compiler Warning (level 1) C4178"
4- ms.date : " 11/04/2016 "
4+ ms.date : " 03/06/2024 "
55f1_keywords : ["C4178"]
66helpviewer_keywords : ["C4178"]
7- ms.assetid : 2c2c8f97-a5c4-47cd-8dd2-beea172613f3
87---
98# Compiler Warning (level 1) C4178
109
@@ -16,16 +15,16 @@ A case constant in a **`switch`** expression does not fit in the type to which i
1615
1716``` cpp
1817// C4178.cpp
19- // compile with: /W1
18+ // compile with: /W1 /permissive
2019int main ()
2120{
22- int i; // maximum size of unsigned long int is 4294967295
23- switch( i )
21+ unsigned int u = 1;
22+ switch (u )
2423 {
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;
2928 }
3029}
3130```
You can’t perform that action at this time.
0 commit comments