Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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_



Yes it has, via unsafe package.

Which ANSI C example should I write for you in Go?


Package 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".


If package unsafe doesn't "count", anything that C compilers allow beyond what ANSI C specifies don't count as C, thus many of its system programming features just vanish.


I don't see how that relates to Go pointers.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: