Skip to content

Rectify example in C4178 #4975

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
---
description: "Learn more about: Compiler Warning (level 1) C4178"
title: "Compiler Warning (level 1) C4178"
ms.date: "11/04/2016"
ms.date: "03/06/2024"
f1_keywords: ["C4178"]
helpviewer_keywords: ["C4178"]
ms.assetid: 2c2c8f97-a5c4-47cd-8dd2-beea172613f3
---
# Compiler Warning (level 1) C4178

Expand All @@ -16,16 +15,16 @@ A case constant in a **`switch`** expression does not fit in the type to which i

```cpp
// C4178.cpp
// compile with: /W1
// compile with: /W1 /permissive
int main()
{
int i; // maximum size of unsigned long int is 4294967295
switch( i )
unsigned int u = 1;
switch (u)
{
case 4294967295: // OK
break;
case 4294967296: // C4178
break;
case 4294967295: // OK, maximum value for type unsigned int
break;
case 4294967296: // C4178, exceeded maximum value
break;
}
}
```