News for hackers. Stuff that matters.
Re:Doom crash after 2.5 years of real-world runtime confirme... by xhrpost on Wednesday September 17, 2025 @10:06AM (#45276014)
Is it common to default to a signed integer for tracking a timer? I realize being unsigned it would still overflow but at least you'd get twice the time, no?
Re:Doom crash after 2.5 years of real-world runtime confirme... by aidenn0 on Wednesday September 17, 2025 @11:43AM (#45277212)
If you get to right before you need to be (taking as long as you want), then wait until overflow, then you still have 12h to do the last tiny part if it's unsigned.
Re:Doom crash after 2.5 years of real-world runtime confirme... by jbreckmckye on Wednesday September 17, 2025 @04:14PM (#45280843)
Some C programmers take the view that unsigneds have too many disadvantages: undefined behaviour for overflows, and weird type promotion rules. So, they try and avoid uints.
Re:Doom crash after 2.5 years of real-world runtime confirme... by tekne on Wednesday September 17, 2025 @05:25PM (#45281571)
Umm, signed integers are UB on overflow; unsigned is always fine.
Re:Doom crash after 2.5 years of real-world runtime confirme... by jbreckmckye on Thursday September 18, 2025 @08:43AM (#45288937)
Sorry, you are correct. I don't think unsigned overflow behaviour was defined until C99 though.

Anyway, in answer to the question, I would guess the reason was because of signed / unsigned type promotion.