reference:
https://github.com/go101/go101/wiki/Some-evaluation-orders-in-multi-value-assignments-are-unspecified
don't do this:
don't do this:
package main
import "fmt"
func f(p *int) int {
*p = 123
return *p
}
func main() {
var x int
y, z := x, f(&x) // no no, evaluation sequence isn't defined.
fmt.Println(y, z)
}
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.