Welcome to DU! The truly grassroots left-of-center political community where regular people, not algorithms, drive the discussions and set the standards. Join the community: Create a free account Support DU (and get rid of ads!): Become a Star Member Latest Breaking News Editorials & Other Articles General Discussion The DU Lounge All Forums Issue Forums Culture Forums Alliance Forums Region Forums Support Forums Help & Search

Otto_Harper

(776 posts)
12. Actually, infinite loops are OK
Sat Nov 16, 2024, 11:16 PM
Nov 16

As long as you apply them correctly. In my pre-BASIC days, I can recall writing a program that used an infinite loop to do housekeeping until an outside interrupt occurred. The interrupt would cause it to GOTO another piece of code, to service the interruption.

The interrupt was signalled by a variable suddenly changing value within the loop, due to actions from the OS. The problem with that code arose when folks started using the new IBM optimizing compiler. The compiler saw that there was nothing inside the loop that changed the variable, and so moved the test to outside of the loop to improve efficiency. Result was a complete loss of control into an infinite loop. On a mainframe. Which cost real money for processor time.

Recommendations

0 members have recommended this reply (displayed in chronological order):

Latest Discussions»The DU Lounge»Thomas E. Kurtz, a Creato...»Reply #12