News for hackers. Stuff that matters.
Re:Proposal: expression to create pointer to simple types by anonacct38 on Monday April 19, 2021 @12:48PM (#26864882)
& doesn't always imply a value is on the heap. Escape analysis will ensure that pointers to the stack are safe.

Here's an example with a bit of explanation: if you pass a value to fmt.Println it will escape. The raw println builtin does not cause values to escape. So calling the first function twice and seeing the same address for the value strongly implies stack allocation while calling the 2nd function twice and getting different addresses implies heap allocation.

https://play.golang.org/p/PSb1wj1-x1c

Re:Proposal: expression to create pointer to simple types by effdee on Monday April 19, 2021 @04:13PM (#26867436)
Minutes ago I was wondering about https://play.golang.org/p/9C0puRUstrP (via https://github.com/golang/go/issues/23440).

Thank you for explaining what's going on there! :)

And btw, compiling the above example with -gcflags="-m" (which I learned about earlier today) proves you right.