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 I find that fiddly. But yeah, if you're disciplined it can work.
@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!