3 ms·
They're not the same. Go doesn't have pointer arithmetic, and Go functions can safely return pointers to values that aren't created via new(). https://play.gol
by echlebek 9y ago
They're not the same. Go doesn't have pointer arithmetic, and Go functions can safely return pointers to values that aren't created via new().
https://play.golang.org/p/m3OdaXH98_ https://play.golang.org/p/m3OdaXH98_
- pjmlp 9y agoYes it has, via unsafe package. Which ANSI C example should I write for you in Go?
- echlebek 9y agoPackage unsafe is in the spec, but converting unsafe.Pointer to uintptr (which is how I'm supposing you'd do your pointer arithmetic) is implementation-defined. This means I could create a perfectly legal implementation of Go where such things result in complete nonsense. I don't think package unsafe "counts".