Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How many ways to get into an endless loop? 2

Status
Not open for further replies.

GwydionM

Programmer
Oct 4, 2002
742
0
0
GB
I've done one - you have a loop that is to be done 7 times, then it gets raised to 15. But it's a language where you define your own data field and you forget to increase it to two digits, so it loops from 9 back to 0.

I also heard of a case where a man set his e-mail to tell anyone who wrote that he'd moved. This got into an endless loop with someone else who'd got an automatic message to say he was on holiday. This may be apocryphal and would certainly be very early - Outlook tells you just once, in my experience.

------------------------------
An old man [tiger] who lives in the UK
 
A java developer at my company (not me!) created an endless loop situation WITHOUT coding for it. For accounting purposes, a tradeshow is divided into virtual "areas" and "sub-areas". This is presented in the GUI application in a tree structure:

area1
-sub area 2
-sub area 3
-sub-sub area4

The user can drag and drop areas and sub-areas around as they wish. Sub area 4 can become a child of area 1 instead of area 3, for example. Everything is stored in the AREA_TABLE. This table has a column for PARENT_AREA_KEY. Somehow the application let a user assign an area to be it's own parent. Everyting was OK until the next day when the user tried to open the screen. All he got was a wait cursor until he ran out of memory. The app was trying to render the tree as such:

--area1
-area1
-area1
-etc...
 
Here is a very nice loop in C. Try it!

while (1)
fork();

 
ah, the good old classics:

knife();
spoon();
and
gravy_boat();

!
 
(another reason I don't like php very much) Many times on live servers PHP will not issue a warning when it reaches MAX_EXECUTE_TIME (or whatever it is). I have been befuddled many times by an infinite loop, as the result is simply blank. I do believe that my last accidental loop went something like this:

TipGiver-

My freshman year in college my roomate was getting aggervated with his online shell host for some reason and asked a fellow student to write a program to bring down the host. First I'd ever seen anyone write code to do damage. I think his solution was something like yours, but with 2^95 computed in there somewhere. (btw - the roomate ended up failing many of his classes and dropping out).



Robert Carpenter
Remember....eternity is much longer than this ~80 years we will spend roaming this earth.
ô¿ô
 
To sum up all of the above, the answer is:

Careful thought.

:)
 
strettonman, excellent, definitely star-worthy (as long as cli comes first).

[vampire][bat]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top