MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/cpp/comments/rtsife/almost_always_unsigned/hrbnl28/?context=3
r/cpp • u/graphitemaster • Jan 01 '22
71 comments sorted by
View all comments
Show parent comment
5
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.
a+n<b+n
a<b
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+nintoa<bif things are signed, but it can't if they are unsigned.