I really, really like unsigned types, to the point of validating and casting into unsigned versions for almost all webgl code. It's a huge help to have a compile-time constraint that values can't be negative. (Also webgl has implicit integer truncation warnings-as-errors, so we don't really worry about mixed-signedness)
If we insist on avoiding standard uint types, I'll be writing uint31_t wrappers. If we're going to recommend against uint types, I would like to see specific compelling examples of problems with them, not just prose about "many people say" or "maybe missed optimizations". On Thu, Jul 4, 2019 at 8:11 AM Botond Ballo <bba...@mozilla.com> wrote: > > On Thu, Jul 4, 2019 at 7:11 AM Henri Sivonen <hsivo...@mozilla.com> wrote: > > > Do you happen to know why? Is this due to worries about underflow or > > > odd behavior on subtraction or something? > > > > I don't _know_, but most like they want to benefit from optimizations > > based on overflow being UB. > > My understanding is yes, that's one of the motivations. > > Another, as hinted at in Gerald's quote, is that tools like UBSan can > diagnose and catch signed overflow because it's undefined behaviour. > They can't really do that for unsigned overflow because, since that's > defined to wrap, for all the tool knows the code author intended for > the overflow and wrapping to occur. > > Cheers, > Botond > _______________________________________________ > dev-platform mailing list > dev-platform@lists.mozilla.org > https://lists.mozilla.org/listinfo/dev-platform _______________________________________________ dev-platform mailing list dev-platform@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-platform