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
6
votes
1 answer
Java - infinite while loop with float
I am currently learnig java float-point numbers. I know, that a float have a specific amount of significant digets. I also know, that a float is represented in java like -1 or 1 * num * 10^x. Where num is the numer and 10^x is the decimal "point".…

Charlie
- 1,169
- 2
- 16
- 31
6
votes
6 answers
Infinite loop when using size_t in a count down for loop
So I'm using size_t instead of int in any indexing for loop to prevent negative indices. But when counting down, this leads to an overflow:
for (size_t i = 10; i >= 0; --i) {
// Do something, f.ex. array[i] = i
}
What would be a nice way to…

AdHominem
- 1,204
- 3
- 13
- 32
6
votes
4 answers
Threads: Termination of infinite loop thread in c++
I am trying to write a thread that would run in the background of my main program and monitor sth. At some point the main program should signal the thread to safely exit. Here is a minimum example that writes local time to the command line at fixed…

Aleksejs Fomins
- 688
- 1
- 8
- 20
6
votes
0 answers
Stop a time consuming function on button click Shiny
I apologize in advance if I am asking a very basic question. I am new to R and Shiny and I could not find a solution to this problem anywhere.
Here, I have a very basic shinyApp that has two buttons in ui.R, Start button will call a function that…

joemath
- 83
- 1
- 4
6
votes
1 answer
Loop every x seconds based on process speed
I am implementing a basic (just for kiddies) anti-cheat for my game. I've included a timestamp to each of my movement packets and do sanity checks on server side for the time difference between those packets.
I've also included a packet that sends a…

majidarif
- 18,694
- 16
- 88
- 133
6
votes
1 answer
Why this code stuck node.js - Bug on Javascript?
I'm trying to run this regex but it stuck my console. Why?
var str = "Шедевры православной музыки - 20 золотых православных песен";
str.match(/^(([\u00C0-\u1FFF\u2C00-\uD7FF]+[^a-z\u00C0-\u1FFF\u2C00-\uD7FF]*)+)…

Moshe Simantov
- 3,937
- 2
- 25
- 35
6
votes
2 answers
Infinite while loop and control-c
So, I wrote the following code:
void main(void) {
int charNums[ALPHABET], i = 1;
char word[MAX];
while(i) {
initialize(charNums, word);
getString(word);
setLetters(charNums, word);
getString(word);
checkLetters(charNums,…

MatthewS
- 455
- 2
- 7
- 22
6
votes
4 answers
infinite loop in c++
I'm learning C++ and writing little programs as I go along. The following is one such program:
// This program is intended to take any integer and convert to the
// corresponding signed char.
#include
int main()
{
signed char sch =…

108
- 1,631
- 3
- 19
- 25
6
votes
2 answers
CURLOPT_TIMEOUT not working at all (php)
I am using curl and setting all the parameters correctly (as far as I know) but CURLOPT_TIMEOUT is being ignored and allowing for an infinite loop. Here is the configuration for my Curl Request:
$user_agent = 'Mozilla/5.0 (Windows NT 6.1; rv:8.0)…

Jamie337nichols
- 157
- 1
- 11
6
votes
4 answers
Infinite while loop in Windows Service
I have a windows in which i have added an infinite while loop in the OnStart() method .I have tested the service for 1 hour and it is running fine.But as this is my first Windows Service so have doubt on the performance with infinite loop.
Here is…

user3924730
- 163
- 1
- 3
- 14
6
votes
1 answer
vb6: interrupt endless msgbox loop
I am writing a program in VB6.
By mistake many times my code contains an endless loop, inside which there is a message box. For example:
while a>0
msgbox "a is positive"
wend
Then I press the play/run and I realize what has happened. Is there…

Thanos Darkadakis
- 1,669
- 2
- 18
- 30
6
votes
1 answer
How to recover unsaved JS changes in JSFiddle with infinite loop?
I accidentally created an infinite loop in JSFiddle, so the page is unresponsive. I haven't saved in a while, so I don't want to reload and lose changes. I'm using Chrome, but it's been twenty minutes and Chrome hasn't yet caught the loop and given…

brentonstrine
- 21,694
- 25
- 74
- 120
6
votes
2 answers
Why does this code give me an infinite loop?
When I enter in a correct value (an integer) it is good. But when I enter in a character, I get an infinite loop. I've looked at every side of this code and could not find a problem with it. Why is this happening? I'm using g++ 4.7 on…

template boy
- 10,230
- 8
- 61
- 97
6
votes
0 answers
ExtJS infinite loop on grid focus
We're using ExtJS 4.2 and ran into weird problem.
There's a grouped grid panel from which we drag elements to a tree panel. In most cases everything is working fine, but sometimes for unknown reason wrong item is dragged or it doesn't happen at all.…

ExC
- 69
- 1
6
votes
2 answers
Hudson infinite loop polling for changes in Git repository?
The git plugin for hudson works well. However, the build script must update a version number in the files in the repository, commit, and push back to the repository.
When Hudson polls next to check for changes, it goes into an infinite loop because…

Wayne
- 2,959
- 3
- 30
- 48