A constant value cannot fall outside of the range inherent to its underlying type:
{% include “docs/reference/fidl/language/error-catalog/label/_bad.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/bad/fi-0066.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
The problem may be fixed either by changing the value to fit within the type's range:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0066-a.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
Or otherwise by changing to the type to accommodate the currently overflowing value:
{% include “docs/reference/fidl/language/error-catalog/label/_good.md” %}
{% includecode gerrit_repo="fuchsia/fuchsia" gerrit_path="tools/fidl/fidlc/tests/fidl/good/fi-0066-b.test.fidl" exclude_regexp="\/\/ (Copyright 20|Use of|found in).*" %}
This error exclusively concerns FIDL's numeric types, all of which have the capacity to overflow. The ranges are sourced from the C++ std::numeric_limits
interface and are as follows:
Type | Minimum | Maximum |
---|---|---|
int8 | -128 | 127 |
int16 | 32768 | 32767 |
int32 | 2147483648 | 2147483647 |
int64 | 9223372036854775808 | 9223372036854775807 |
uint8 | 0 | 255 |
uint16 | 0 | 65536 |
uint32 | 0 | 4294967295 |
uint64 | 0 | 18446744073709551615 |
float32 | -3.40282e+38 | 3.40282e+38 |
float64 | -1.79769e+308 | 1.79769e+308 |