Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(+2)

Been working through the book slowly. Overall this has been really good so far.

Some feedback from someone who hasn’t done a ton with Pointers.

The chapter on pointers talks a lot about what pointers/addressables do, but doesn’t really discuss why we need pointers. Maybe it’s because Odin isn’t object oriented, likely because of the immutability aspect.

I have an idea, on this, but I feel like having examples on what not using pointers would do would be helpful. Most of the languages I’ve used so far, haven’t really been ones that used a lot of pointers.

Like, I’m pretty sure if I’m not using pointers, I’m essentially creating new data at new memory locations and losing the old memory or I’m running into errors.

I thought the addressables section may touch on this more, but not in as a direct way as I was hoping.

From the Addressable section, this confused me as well: “In which case element_pointer would not point to the tenth element of array. Instead, it would point to an in-between value.”

I think this is where emphasizing about getting a copy would be better. I had no idea what you meant by in-between value. I ended up doing some searching and confirmed my theory that element_pointer would contain a pointer to a copy of the data that would have been in the array.

I can see someone who isn’t as far along the path being very confused. I kinda feel like I understand, but will definitely have to do some simple experiments to confirm I’m understanding what I suspect.

(+3)

Thank you for reading and for the feedback Michael!

I’ve added your comments to my TODO and will look at them when I make an update for the book.

Like you say, perhaps the chapters needs more examples. For now, just note that in the subsequent chapters, I will touch upon different cases when pointers are useful and when they should be avoided. Hopefully as your read on, more and more questions will be answered.