You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As far as I can see, the spec does not let me predict the result of this program. The
spec doesn't say anything clearly about comparing two pointers to zero-sized objects.
Both 6g and gccgo current print "true", so I would vote for formalizing that.
package main
type S struct { }
type A [10]S
func main() {
var a A
p1 := &a[0]
p2 := &a[1]
if p1 == p2 {
println("true")
} else {
println("false")
}
}
The text was updated successfully, but these errors were encountered:
The spec should make clear that while it is permissible
for pointers to distinct 0-sized objects to compare equal,
it is also permissible for them to compare unequal.
No guarantee is made.
For example,
x := make([]struct{}, 10)
y := make([]struct{}, 10)
&x[0] == &y[1]? Maybe.
Russ
The text was updated successfully, but these errors were encountered: