+ 2

Infinite Loop

Is there any case in programming where the infinite loop becomes usefull ?!

21st Apr 2018, 6:47 PM
Hasna Oulaiz
7 odpowiedzi
+ 7
As @Xan said; Take for instance a game consoles' controller. They often use an infinite loop waiting for a button press, which when pressed goes off and runs some code (usually in another thread) and then returns to the loop waiting for the next button press, etc. This was how it worked when programming custom apps for the PSP back in the day.
21st Apr 2018, 7:05 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
If it breaks out, then it's not infinite. Some embedded systems sometimes run their main loop 'infinitely'. They look out for event triggers, and call event callbacks from that loop, either asynchronously or synchronously.
21st Apr 2018, 6:58 PM
Emma
+ 2
Never... They can have a very long duration but infinite is not searched
21st Apr 2018, 7:29 PM
KrOW
KrOW - avatar
+ 2
KrOW Yes, obviously nothing is truly infinite in our universe. However, the term 'infinite loop' is a programming term, that means there is no exit condition programmatically speaking. This is almost certainly what the original poster meant.
21st Apr 2018, 7:32 PM
Emma
+ 2
If it mean like form (while true) then it can be useful if there are multiple complex condition to break it but from a pure logic view, its never useful
21st Apr 2018, 7:38 PM
KrOW
KrOW - avatar
+ 2
@Dona @Xan @ChaoticDawf @KrOW thank u guys for ur informations 🙌
22nd Apr 2018, 5:24 PM
Hasna Oulaiz
+ 1
I remember using it for a deauthentication attack against Wi-Fi APs, so yes, it's useful if you're into that kind of things... Maybe you'll be trying to refresh something after some time if you're not using a timer (better use a sleep inside the loops)...
12th May 2018, 5:52 PM
MERZAK Mohamed
MERZAK Mohamed - avatar