HOME
        TheInfoList






In computer programming, an infinite loop (or endless loop)[1][2] is a sequence of instructions that, as written, will continue endlessly, unless an external intervention occurs ("pull the plug"). It may be intentional.

Alderson loop

Alderson loop is a rare slang or jargon term for an infinite loop where there is an exit condition available, but inaccessible in the current implementation of the code, typically due to a programmer's error. These are most common and visible while debugging user interface code.

A C-like pseudocode example of an Alderson loop, where the program is s

A C-like pseudocode example of an Alderson loop, where the program is supposed to sum numbers given by the user until zero is given, but where the programmer has used the wrong operator:

sum = 0;
while (true) {
   printf("Input a number to add to the sum or 0 to quit");
   i = getUserInput();
   if (i * 0) { // if i times 0 is true, add i to the sum. Note: ZERO means FALSE, Non-Zero means TRUE. "i * 0" is ZERO (FALSE)!
      sum += i; // sum never changes because (i * 0) is 0 for any i; it would change if we had != in the condition instead of *
   }
   if (sum > 100) {
      break;    // terminate the loop; exit condition exists but is never reached because sum is never added to
   }
}

The term allegedly received its name from a programmer (last name Alderson) who in 1996[12] had coded a modal dialog box in Microsoft Access without either an OK or Cancel button, thereby disabling the entire program whenever the box came up.[13]

See also