3 ms·
Go has true pointers. If you mean pointers arithmetic, that can be achieved with unsafe package.
by pjmlp 2y ago
Go has true pointers.
If you mean pointers arithmetic, that can be achieved with unsafe package.
- weinzierl 2y agoFrom my vantage, pointers without arithmetic are typically called references, as opposed to "true" pointers. I did not mean it in a derogatory way, both have their place and Go is a great language even (or maybe despite) without what I would call "true" pointers.
- pjmlp 2y agoFrom CS point of view, references are pointers that you can't get the underlying value behind them. Being able to do arithmetic is orthogonal to that. In fact check a language like D, C#, Swift, with references, pointers, and pointers with arithmetic.
- trealira 2y agoThe fact that, in Go, you can have pointers to pointers, and reassign pointer variables like any other, would imply, IMO, that pointers are first-class values, and so they are true pointers, even without being able to pointer arithmetic with them.