What is the difference between go pointers, c pointers and rust pointers?
Compared to C, Go pointers are type safe and lack pointer arithmetic. I don’t know Rust. The specs are out there.
To expand on @calmh response:
Go does have pointers but not in the sense that C has pointers.
Go uses Pointers as a feature to achieve two things:
- explicit differentiation between call by ref/call by value
- more efficiency (you cannot manipulate the pointer but you can make sure you don’t accidentally copy values around)
Compared to C this means you can’t do certain things (like pointer arithmetic) - but it also means you can’t shoot yourself in the foot.
This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.