Skip to content

Commit 5348ad6

Browse files
authored
Merge pull request #5487 from MicrosoftDocs/FromPublicMasterBranch
Confirm merge from FromPublicMasterBranch to main to sync with https://github.com/MicrosoftDocs/cpp-docs (branch main)
2 parents 253c136 + 61d8ea5 commit 5348ad6

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed
Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
---
22
description: "Learn more about: Compiler Warning (level 1) C4178"
33
title: "Compiler Warning (level 1) C4178"
4-
ms.date: "11/04/2016"
4+
ms.date: "03/06/2024"
55
f1_keywords: ["C4178"]
66
helpviewer_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
2019
int 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
```

0 commit comments

Comments
 (0)