Standard library / reflect

reflect.Value.OverflowUint()

Check whether the candidate uint value exceeds the represented numeric type’s range; does not detect every precision loss. Expected stdout: 'true\n'.

Formal Syntax & Structure

go syntaxgo
func (v Value) OverflowUint(x uint64) bool

Parameters & Attributes

NameTypeDescription
xuint64Candidate numeric value to check against the receiver type’s range.

Return Value

bool

Check whether the candidate uint value exceeds the represented numeric type’s range; does not detect every precision loss.

Working Example

Example Snippetgo
package main
import (  "fmt"  "reflect")
func main() { fmt.Println(reflect.ValueOf(uint8(0)).OverflowUint(256)) }
Go Reference