Why not use the PC's timer interrupt for the delay function itself?
Why not use the PC's timer interrupt for the delay function itself?
This bug was just laziness on Borland's part; there were no excuses for it. There were any number of ways to do it correctly. Fortunately they fixed it pretty quickly, too. While I remember running into it, it wasn't a huge issue.
The original Turbo Pascal ran on PCs of the day, running at 4.77MHz, and with 64 kilobytes of RAM.
Even if one foresaw computers running at 200MHz, I don’t think that, at the time, it was clear that a single architecture would stay around long enough for that to be a problem. The Pentium Pro peaked at 200MHz in 1995-8 or so, 12 to 15 years after the first release of Turbo Pascal (https://en.wikipedia.org/wiki/Pentium_Pro)
Earlier versions do not have this particular bug, it was introduced in version 7. However they have another bug which causes Delay to simply not work properly (it finishes quicker than requested) and most likely the changes in ver7 were made in an attempt to fix that one.
(Aside: all things staying the same, that should have increased the limit by a factor of 55. It seems the processor got more efficient running these idle loops by a factor of about five (about 2½ if there’s a sign bit in the result of the division)
So yes, you could call this a different bug. I don’t think having that bug in the code is inexcusable, though.
TP7 is from March 1993 (http://progopedia.com/version/turbo-pascal-7.0), and it seems the first 200Mhz PC CPU was from November 1995 (https://en.wikipedia.org/wiki/Timeline_of_computing_1990–199...)
⇒ I don’t think they could have found this in testing. So, is it inexcusable that this went through code review? I don’t think so. Not only would one have to realize that that new limit now came into play, one also would have realized the higher efficiency of the 200MHz processor(s) would bring the number down further.