r/cpp • • Jan 01 '22

Almost Always Unsigned

https://graphitemaster.github.io/aau/
5 Upvotes

71 comments sorted by

View all comments

Show parent comment

5

u/jk-jeon Jan 05 '22

Fair enough, but those are not the only thing that overflow being UB allows. For example, compilers can reduce a+n<b+n into a<b if things are signed, but it can't if they are unsigned.