Closed larsks closed 3 years ago
The I32p()
if just a convenience function to prevent us from having to cast an int()
to an *int32()
.
There is no reason for that to be there other than for convenience sake. In the sample you suggested it looks to be superfluous. Feel free to open a PR if you want.
Also -- another consideration is that Go will type cast literals onto types if it can figure them out.
i := 0 // <--- i is now an int
var ii int32
ii = 0 // <--- i is now an int32
so if you are passing in a variable - you will need the convenience function - if you are defining it literally then go will type cast for you.
types are hard. hope this helps.
Sorry for what is probably a basic question, but why this...
Instead of this:
? If I'm reading things correctly, that's returning a pointer to an integer, but elsewhere in the sample example you're able to use a literal integer without conversion, e.g.:
Thanks!