
Sign up to save your podcasts
Or
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.
3.6
55 ratings
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.
272 Listeners
365 Listeners
284 Listeners
265 Listeners
590 Listeners
621 Listeners
141 Listeners
74 Listeners
987 Listeners
7,913 Listeners
189 Listeners
944 Listeners
47 Listeners
16 Listeners
12 Listeners