Hello. May be because all zero-size values have the same pointer: https://go.dev/play/p/n0dKQFN2EpR Because the values have no memory location.
четверг, 28 ноября 2024 г. в 14:21:06 UTC+3, Jochen Voss: > Dear all, > > I am looking at the source code for the new "unique" package (just out of > curiosity). > One thing I did not understand: why is `zero` defined to be an `uintptr`? > > https://cs.opensource.google/go/go/+/master:src/unique/handle.go;l=16 > > My understanding is the `zero` variable just provides a unique memory > location, and any type, e.g. byte, would have worked just as well. Is this > right? Was uintptr choosen for performance reasons? Or to guarantee > alignment? > > Many thanks, > Jochen > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion visit https://groups.google.com/d/msgid/golang-nuts/248ca7dc-debb-438e-b858-bdc6aa2c2e17n%40googlegroups.com.