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...
@cjd For sure! Makes sense to create a typedef in certain domains. But spreading that typedef too broadly really muddies things for most people.
@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 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.
Revel in the marvels of the universe. We are a collective of forward-thinking individuals who strive to better ourselves and our surroundings through constant creation. We express ourselves through music, art, games, and writing. We also put great value in play. A warm welcome to any like-minded people who feel these ideals resonate with them.