Other Definitions
infinite loop (dict)

Infinite Loop

An infinite loop is a sequence of instructions in a computer program which loops endlessly. There are a few situations when this is desired behavior. For example, many server programs such as Internet or database servers loop forever waiting for and servicing requests. More often, though, the term is used for those situations when this is not the intended result; that is, when this is a bug. Such errors are made by experienced programmers as well as novices, and their causes can be quite subtle. One common cause, for example, is that the programmer intends to iterate over a collection of items such as a linked list, executing the loop code once for each item, but improperly formed links which create a reference loop in the list, causing the code to continue forever. Unexpected behavior of a terminating condition can also cause this problem. Here's an example (in C):
   float x = 0.1;   while (x != 1.1) {     x = x + 0.1;     printf("x = %f\n", x);   } 
On some systems, this loop will run ten times as expected; but on some systems it will never terminate. The problem is that the loop terminating condition (x != 1.1) tests for exact equality of two floating point values, and the way floating point values are represented in many computers will make this test fail, because 1.1 cannot be represented exactly. Changing the test to something like while (x < 1.10001) will fix the problem (as will not using floating point values for loop indexes). A similar problem occurs frequently in numerical analysis: in order to compute a certain result, an iteration is intended to be carried out until the error is smaller than a chosen tolerance. However, because of rounding errors during the iteration, the tolerance can never be reached, resulting in an infinite loop. While most infinite loops can be found by close inspection of the code, there is no general method to determine whether a given program will ever halt or will run forever; this is the undecidability of the halting problem.

Pseudo-infinite loops

A pseudo-infinite loop is a loop that appears infinite but is really just long loop. An example in C:
  unsigned int i;  for (i=1;i>0;i++)  { loop code } 
This appears like it will go on for ever, but due to memory limitations, the value of i will roll back to 0, breaking a the loop. The actual limit of i depends on the details of the system and compiler used.So in theory: it is extremely complex and confusing.

See also

 

<< PreviousWord BrowserNext >>
animal crackers
bleen
snark
the hunting of the snark
david zindell
congruence
jonathan livingston seagull
robert peel
toponym
grard depardieu
subalgebra
kernel (algebra)
isomorphism theorem
reds
chac mool
korn
user interface
the annotated alice
orange county (disambiguation)
clear and present danger
biosafety
safe trade
biosecurity
hogwarts express
de bruijn newman constant
blue green alliance
military fiat
ecology movement
peace movement
ngo
cuthbert
arthur sullivan
indigenous peoples
bonobo
w. s. gilbert
natural capitalism
cuthbert of lindisfarne
atmospheric reentry
1240s bc
thread
santa rosalia
thread (computer science)
clifford algebra
kyzyl kum