[go-nuts] Re: Comparison of pointers to distinct zero-sized variables

2024-06-20 Thread tapi...@gmail.com
see: https://github.com/golang/go/issues/65878 package main var a, b [0]int var p, q = &a, &b func main() { if (p == q) { p, q = &a, &b println(p == q) // false } } On Thursday, June 20, 2024 at 12:59:43 AM UTC+8 Oliver Eikemeier wrote: > I'm observing some strange behavior and could use some

[go-nuts] Re: Comparison of pointers to distinct zero-sized variables

2024-06-19 Thread Oliver Eikemeier
Hi, Brian Candler schrieb am Mittwoch, 19. Juni 2024 um 19:17:48 UTC+2: There was a similar discussion here: https://groups.google.com/g/golang-nuts/c/JBVqWYFdtC4/m/VJC2OLJcAQAJ Thanks for the link, very insightful. I learned: 1. This gets reported about once a year

[go-nuts] Re: Comparison of pointers to distinct zero-sized variables

2024-06-19 Thread 'Brian Candler' via golang-nuts
There was a similar discussion here: https://groups.google.com/g/golang-nuts/c/JBVqWYFdtC4/m/VJC2OLJcAQAJ It is very sensitive to exactly how the variables are used. For example, if you replace your println() with fmt.Println() then you get a different answer. https://go.dev/play/p/D5z4q6iCTke