An "infinite loop" is a loop in which the exit criteria are never satisfied; such a loop would perform a potentially infinite number of iterations of the loop body. The general problem of determining whether the execution of a loop with given preconditions will result in an infinite loop is undecidable; in other words, there is no algorithm to determine whether an execution of a loop will eventually terminate. This is known as the halting problem.
Questions tagged [infinite-loop]
3528 questions
1
vote
1 answer
Figuring out loop error
So I'm having an infinite loop problem, but I simply cannot find out what/where it is.
I have an arrayList called dailyPlanetStreet filled with objects of either class
Goodguy Badguy Person or NormalGuy. In my removing mechanism below, if there is…

user3072997
- 13
- 4
1
vote
2 answers
Why doesn't this singleton concept produce an infinite loop?
I found this searching for singleton concepts in Python. What I wonder about is why self._instance = super(Singleton, self).__new__(self)doesn't cause an infinte loop. I thought that calling __new__ would start a kind of recursion, as…

Xiphias
- 4,468
- 4
- 28
- 51
1
vote
1 answer
C, looping exit condition
This is a bit of a long post so bear with me. The gist of what I am trying to do is get some user input at the beginning of a loop, do some things depending on that input and possibly repeat. Simple enough right? Here is what I have.
void…

Zack
- 13,454
- 24
- 75
- 113
1
vote
3 answers
Assigning an array inside a while loop causes infinite loop
$pie = array('Apple' => 1, 'Cherry' => 3, 'Pumpkin' => 6);
reset($pie);
while (list($k, $v) = each($pie)) {
echo "$k => $v\n";
$desserts[]=$pie;
}
If the $desserts[]=$pie line is commented out, this code block executes as expected.
Why when…

Swoop
- 514
- 5
- 17
1
vote
1 answer
Why there is an infinite for loop?
The programm falls in the infinite loop. But arr->count printf prints a normal value (4, for example). count has a type unsigned int and arr is a pointer to int. What's the problem here? loop prints arr values at first and then continues to print…
user3000073
1
vote
1 answer
Fluents of more than one goal in prolog
This is a block world problem which is going to move the blocks where we want them to be.
The predicate located_on tells us the locations of blocks according to the fluents. The goal_state is where we want the blocks to be.
The third parameter of…

Jiang Xiang
- 3,166
- 5
- 21
- 31
1
vote
0 answers
C++ Catching mouse input, resetting position causes infinite loop?
I'm coding a 3d game, and I want to change the yaw for my camera using:
case WM_MOUSEMOVE:
xPos = (LOWORD(lParam)+(1680/2));
yPos = (HIWORD(lParam)+(1050/2));
graphics.Yaw(xPos);
SetCursorPos(1680/2 , 1050/2);
…

Ang0
- 11
- 3
1
vote
1 answer
Server Transfer with preserveForm true in EventHandler refires that event Handler
Server Transfer with preserveForm true in EventHandler refires that event Handler and causes infinite loop.
MY QUESTION: How can I indicate in the handler that the event has been handled.
PS: I know we can set the preserveForm to false, but I dont…

dotnetveen
- 13
- 4
1
vote
1 answer
Infinite Loop while reading a file
This is my piece of code where I am trying to read from a file. My file currently has 4 lines but code is not coming out of the loop after reading those lines.
public class ViewServlet extends HttpServlet {
private static final long…

user2889968
- 35
- 3
- 10
1
vote
1 answer
How to stop this AJAX?
I wanted to implement Comet in PHP and came across this page:
http://www.zeitoun.net/articles/comet_and_php/start
The second method explained in the article works fine for me. In the backend php file, the loop seems to be infinite:
// infinite loop…

Nirmal
- 9,391
- 11
- 57
- 81
1
vote
2 answers
How do create perpetual animation without freezing?
I am still a newbie at Javascript. I tried writing a program to make images fadeToggle all the time, so I used the while conditional statement (combined with a constant variable); after running that and freezing my computer (then remembering that…

Le Jeune
- 13
- 3
1
vote
1 answer
invalid int input gets stuck in an infinite loop
do
{
cout << "Enter the numerator and denominator of the first fraction: ";
cin >> a >> b;
cout << endl;
cout << "Enter the numerator and denominator of the second fraction: ";
cin >> c >> d;
cout << endl;
} while…

Juan Sierra
- 75
- 2
- 7
1
vote
1 answer
Encountering infinite recursion when using shelve module in Python
I am writing a web crawler using Mechanize and BeautifulSoup4 in Python. In order to store the data it collects for further analysis, I am using the shelve module. The block of code in which an issues arises is here. …

Max Candocia
- 4,294
- 35
- 58
1
vote
1 answer
Stop a php infinite loop-currently running
I have a seemingly simple problem.
I was looking for an error in a php function that wouldn't return the result. So, quite stupidly, I put mail() functions in different areas of the function to see where it hangs up.
I narrowed it down to a while…

theflionking
- 72
- 1
- 8
1
vote
2 answers
jQuery .remove() call in callback triggers infinite loop
While I have the problem itself seemingly resolved, I'm hoping someone can shed some light on the why of this...
Below are two snapshots of the same function whose job is to remove a div that contains a user feedback message. It's setup to use an…

Crazy Joe Malloy
- 834
- 6
- 14