Artwork

Content provided by Dominic St-Pierre. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Dominic St-Pierre or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.
Player FM - Podcast App
Go offline with the Player FM app!

003: Pointers or !Pointers, stack, and heap

17:10
 
Share
 

Manage episode 319434670 series 3302141
Content provided by Dominic St-Pierre. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Dominic St-Pierre or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

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.

  continue reading

39 episodes

Artwork

003: Pointers or !Pointers, stack, and heap

go podcast()

25 subscribers

published

iconShare
 
Manage episode 319434670 series 3302141
Content provided by Dominic St-Pierre. All podcast content including episodes, graphics, and podcast descriptions are uploaded and provided directly by Dominic St-Pierre or their podcast platform partner. If you believe someone is using your copyrighted work without your permission, you can follow the process outlined here https://player.fm/legal.

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.

  continue reading

39 episodes

All episodes

×
 
Loading …

Welcome to Player FM!

Player FM is scanning the web for high-quality podcasts for you to enjoy right now. It's the best podcast app and works on Android, iPhone, and the web. Signup to sync subscriptions across devices.

 

Quick Reference Guide