Hacker News .hnnew | past | comments | ask | show | jobs | submit | rapidloop's commentslogin

"The default type (used for inference) for an int constant is int, which is a 32-bit type" -- this is not true, the size of int is platform-defined. See https://golang.org/ref/spec#Numeric_types. The error you're seeing is because on 32-bit platforms where int is 32 bits, 2^64-1 does not fit an int, and on 64-bit platforms where int is 64 bits, 2^64-1 does not fit an int either (int's are signed). This will work on 64-bit platforms though:

  a := math.MaxInt64
  fmt.Println(a)


Unfortunately, the transcription doesn't match what I said. The video is now available at https://youtu.be/zPd0Cxzsslk


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: