== Why is this an issue?

Numbers are infinite, but the types that hold them are not. Each numeric type has hard upper and lower bounds. Try to calculate or assign numbers beyond those bounds, and the result will be surprising:

* For unsigned types, it will be a value that has silently wrapped around from the expected positive value to another one, following the rules of modular arithmetic (if the maximum ``++unsigned char++`` is 255, adding 10 to an ``++unsigned char++`` equals to 250 will yield the value 4)
* For signed type, this is undefined behavior.

=== Noncompliant code example

[source,cpp]
----
void test(char c) {
  switch (c) {
    case 2000: // Noncompliant
      // ...
      break;
  }

  int a = 4608 * 1024 * 1024; // Noncompliant
}
----

== Resources

include::../common/resources/standards.adoc[]


ifdef::env-github,rspecator-view[]

'''
== Implementation Specification
(visible only on this page)

=== Message

overflow in expression

overflow converting case value to switch condition type


include::../highlighting.adoc[]

'''
== Comments And Links
(visible only on this page)

include::../comments-and-links.adoc[]

endif::env-github,rspecator-view[]
