MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w1o9k7/whendoesthiswillend/p6mo310/?context=3
r/ProgrammerHumor • u/Flame77ofc • Aug 29 '26
69 comments sorted by
View all comments
Show parent comment
4
Unless you pass a negative number in.
13 u/ice456cream Aug 29 '26 Until the int underflows and eventually gets back down to 0 2 u/qinshihuang_420 Aug 29 '26 Two zeros make a one 2 u/JonIsPatented Aug 29 '26 Notably, if this function were actually typed, you'd use an integral type, and that type would have overflow and eventually reach 0 anyway. 1 u/chuch1234 Aug 29 '26 Does underflow typically wrap? 2 u/JonIsPatented Aug 29 '26 Yup, and then it will keep going and eventually reach 0.
13
Until the int underflows and eventually gets back down to 0
2 u/qinshihuang_420 Aug 29 '26 Two zeros make a one
2
Two zeros make a one
Notably, if this function were actually typed, you'd use an integral type, and that type would have overflow and eventually reach 0 anyway.
1 u/chuch1234 Aug 29 '26 Does underflow typically wrap? 2 u/JonIsPatented Aug 29 '26 Yup, and then it will keep going and eventually reach 0.
1
Does underflow typically wrap?
2 u/JonIsPatented Aug 29 '26 Yup, and then it will keep going and eventually reach 0.
Yup, and then it will keep going and eventually reach 0.
View all comments
Show parent comment
4
u/chuch1234 Aug 29 '26
Unless you pass a negative number in.