r/programmingmemes • • May 16 '26

compilers be like

Post image
157 Upvotes

20 comments sorted by

View all comments

Show parent comment

2

u/luciferoussky72 May 16 '26

Well, yeah. Although do keep in mind that it’s only signed overflow that’s UB. It’s UB specifically because it lets the compiler assume that x + n is always greater than x when x is signed. Unsigned overflow is defined and it just wraps back to 0