003: Pointers or !Pointers, stack, and heap
What are pointers. When not to use pointers and are pointers an optimization vs. using variables.
We go over what are pointers and when to use or not use them. For instance, this is probably not a good use for pointers.
func main() {
var i int = 10
abc(&i)
}
func abc(i *int) {
*i = 15
}
In my opinion any dereferencing is probably bad. Better way:
func main() {
var i int = 10
i = abc(i)
}
func abc(i int) int {
return 15
}
I also try to give some basics info regarding the stack and heap and why pointers might not be seen as an optimization.
I have a course on building SaaS in Go.
Follow me on Twitter.
func main() {
var i int = 10
abc(&i)
}
func abc(i *int) {
*i = 15
}
In my opinion any dereferencing is probably bad. Better way:
func main() {
var i int = 10
i = abc(i)
}
func abc(i int) int {
return 15
}
I also try to give some basics info regarding the stack and heap and why pointers might not be seen as an optimization.
I have a course on building SaaS in Go.
Follow me on Twitter.
Creators and Guests
![Dominic St-Pierre](https://img.transistor.fm/HCtTIm4fjr-PPNKVTdewmxYFfFJgSQJkWYmXjb1QLug/rs:fill:400:400:1/q:60/aHR0cHM6Ly9pbWct/dXBsb2FkLXByb2R1/Y3Rpb24udHJhbnNp/c3Rvci5mbS9wZXJz/b24vZjIxMjQyNjAt/NDMwMy00ZWYzLWIz/MDQtMGU0ZTMxNjZl/ZGQ5LzE3MDcxNDYy/MzYtaW1hZ2UuanBn.webp)
Host
Dominic St-Pierre
Go system builder - entrepreneur. I've been writing software systems since 2001. I love SaaS, building since 2008.
![003: Pointers or !Pointers, stack, and heap](https://img.transistor.fm/bF6iLV4xtxdYH5mX8t_vf_A5r7knvK8pvJT3yTiumtQ/rs:fill:800:800:1/q:60/aHR0cHM6Ly9pbWct/dXBsb2FkLXByb2R1/Y3Rpb24udHJhbnNp/c3Rvci5mbS9zaG93/LzI3MjkyLzE2NDE1/NjU2MDgtYXJ0d29y/ay5qcGc.webp)