5 ms·
no, I get that, but int is not for pointer<->integer conversions. That is very specifically a separate type: uintptr an unsigned integer large enough to
by Vendan 8y ago
no, I get that, but int is not for pointer<->integer conversions. That is very specifically a separate type:
uintptr an unsigned integer large enough to store the uninterpreted bits of a pointer value
https://golang.org/ref/spec#Numeric_types https://golang.org/ref/spec#Numeric_types
- scott_s 8y agoSure, but did I imply it was? I’m genuinely confused.
- Vendan 8y ago> language allows casting pointers to integers The original thread was about converting int to be an arbitrary precision type: "so that 'int' can become a true integer". One would imagine that, to preserve the ability to do pointer <-> non-pointer number, they would just leave uintptr alone, and so basically ignore your concerns, whereas int as the "native type" for slice indexes and the like is a more likely reason to prevent messing with "int" itself
- scott_s 8y agoOkay, that's the source of the confusion. I was not replying to that sentiment, which is a nuanced discussion on what an int should be. I was replying to the_clarence's categorical dismissal of variable width integer types.