Hacker News new | ask | show | jobs
by jmclnx 1211 days ago
> Try not to write clever code. Try to write well-organized code.

Decades ago someone wrote an empty loop to do "something" and it looped for a fixed number of times. No one knew why. But seemed that loop depended upon the frequency of the CPU. It was kind of a sleep (I forgot most of the details) that was needed for some reason. When the system was upgraded, things stated breaking.

That statement should be a tattoo on everyone's hand :)

1 comments

Busy loops for delays used to be common. That is why some old PCs had a "turbo mode" switch. When on, the system ran at full speed. When off, it slowed down to match timing of old games etc.

On a DOS PC, a better way to delay would be to count timer interrupts.