uints are used pretty heavily in cryptography when you want to do modular arithmetic by exploiting the fact that they overflow in a reliable way, so I think they have more use cases than just addresses...
@octesian I've tried that in the past. I found that in practice even things that seem unsigned like the size of an array have a way of infecting everything. If the size is unsigned, the index must be unsigned to compare cleanly to it in a loop. And if the index is unsigned, iterating in reverse order gets tricky. These days I do this in C++: https://git.sr.ht/~akkartik/mu-normie/tree/main/item/linux/bootstrap/bootstrap.h#L269
@octesian I find that fiddly. But yeah, if you're disciplined it can work.
@octesian Though I really don't understand how negative numbers can be less useful than numbers >= 2^31. (I agree that using -1 as an error code suxxors hard. But it's not the first use of negative numbers that comes to mind.)
@akkartik it’s not a contest of most usefulness, it’s about least annoyance. I dislike them because most of the time negative numbers aren’t valid values yet I still have to validate function inputs to make sure someone didn’t pass in a negative by mistake. I’m curious where you’re finding all these uses for negative integers.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!