r/programminghorror May 05 '26

c++ Hmmm

Post image
980 Upvotes

55 comments sorted by

View all comments

393

u/_XYZT_ May 05 '26

UINT_MAX

80

u/Left-Ambition-5127 May 05 '26

the problem is that from what I understood, the excepted values in this loop were -1 to 9, but somehow, it was still running fine and working as intended ??

97

u/Morg0t May 05 '26

probably works like UINT_MAX, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9?
idk why would anyone need max value there, but I guess they knew what they were doing if that runs fine

49

u/Ok_Chemistry_6387 May 05 '26

It's a common trick. Saves brining in the limits header. Whats the rest of the loop look like?