Hacker News new | ask | show | jobs
by cromwellian 5360 days ago
One has pointers and no security model and produces binary processor-dependent artifacts, the other has to support untrusted code, mobile code that runs on any device.
1 comments

Go doesn't really have pointers in the same manner as C, though, does it?

As was as I was aware, you can only have a pointer to an actual object.

Go allows you to take the address of any value. You just can't do pointer arithmetic like you can in C. That is, you can't address uninitialized memory.
I assume you mean "any lvalue"? You can't take the address of rvalues, can you?
Go doesn't define "lvalues," in the spec, but it does define "addressability." My comment would be more accurate if I had said "Go lets you take the address of any value in memory." (stack or heap)
I don't think Go lets you take stack addresses. If you try to do that, it will copy the data structure onto the heap.
The compiler is free to optimize this how it sees fit. Taking the address of a value doesn't necessarily move it to the heap.