11 ms·
We actually had a debate about this. I was initially in favor of "signed as default", but I acquiesced. In retrospect, I think I was wrong and that "unsigned a
by niklasgray 7y ago
We actually had a debate about this. I was initially in favor of "signed as default", but I acquiesced.
In retrospect, I think I was wrong and that "unsigned as default" works better.
I think the domain is important here. We're building a game engine, so there's actually plenty of bit fiddling. We also make use of the "overflow wraparound" of unsigneds in a lot of places.
I think in our case having 99 % unsigned is more feasible than having 99 % signed. There are actually not many things that we would need to use a signed integer for.
FYI, in our codebase right now we have
10038 uint32_t
123 int32_t
7843 uint64_t
58 int64_t
So at the moment we're actually 98.998 % unsigned.
I know it's not 99 %, but it's pretty close :)
- Aardappel 7y agoWell, you have the facts to back it up, so indeed it can work for you. I'd say it requires quite some commitment to push it that far though, and I still would think it's not the right default for almost all teams. Impressive you made it work :)