Massassi Forums Logo

This is the static archive of the Massassi Forums. The forums are closed indefinitely. Thanks for all the memories!

You can also download Super Old Archived Message Boards from when Massassi first started.

"View" counts are as of the day the forums were archived, and will no longer increase.

ForumsDiscussion Forum → Don't you just hate coding "While" loops?
Don't you just hate coding "While" loops?
2004-06-05, 10:14 PM #1
... I do because if you mess up and give it a infinite condition, you risk crashing whatever you are programming! [http://forums.massassi.net/html/mad.gif] Not matter WHAT language you are using, if you mess up a while loop, expect to have to smack ctrl+alt+del to abort.

So... to make SOME sort of discussion out of this, have you ever got yourself in a mess because you wrote a bad while loop? What language and what program did you freeze up and crash because of your mistake?

For me... I've crashed Jedi Knight once while doing come cogging on weapon selection. (game frozed and I was forced to reset the computer) Another time was in JavaScript when coding a menu roll over. I had a alert message in the while loop so I had to use ctrl+alt+del to abort IE because alert boxes disable the window (BTW... a great way to piss off visiters from your website if you code this in intentionally, hehe!). Another time was in ActionScript in which I was doing weapon selection (again). It crashed Flash and I lost some code in the process (Errr!! [http://forums.massassi.net/html/mad.gif] ).

-- SavageX

------------------
"...and if you don't like that, then you need to be slugged in the face repeatedly, until my hands are soaked in blood. Have a nice day!"
http://geocities.com/savagex378

[This message has been edited by SavageX378 (edited June 06, 2004).]
The cake is a lie... THE CAKE IS A LIE!!!!!
2004-06-05, 11:51 PM #2
ctrl + break
"The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. " - Bertrand Russell
The Triumph of Stupidity in Mortals and Others 1931-1935
2004-06-06, 12:16 AM #3
I created in infinite loop in php once... uses all my sites bandwidth in seconds [http://forums.massassi.net/html/frown.gif]

------------------
WARNING: THIS POST MAY CONTAIN TRACES OF PEANUT!
----@%
TheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWho
SaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTh
eJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSa
ysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJ
k
WhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSays
N
iTheJkWhoSaysNiTheJkWhoSaysNiTheJkWhoSaysNiTheJkW
2004-06-06, 1:29 AM #4
Quote:
<font face="Verdana, Arial" size="2">Originally posted by SavageX378:
...Not matter WHAT language you are using, if you mess up a while loop, expect to have to smack ctrl+alt+del to abort.</font>


Not if your using Perl... [http://forums.massassi.net/html/wink.gif]
[/sing]

------------------
Dear lady, can you hear the wind blow, and did you know
Your stairway lies on the whispering wind.
:wq
And when the moment is right, I'm gonna fly a kite.
2004-06-06, 2:59 AM #5
Lots of C++ compilers will attempt to detect such loops. And not to mention, if it is a console program, just hit ctrl+c. Bang, end of program.

------------------
"The future is not determined by a throw of the dice, but is determined by the conscious decisions of you and me."
I am addicted to ellipses!!! AHHH!!! ...
Make Sorrowind Worthwhile... join it! http://sorrowind.net
2004-06-06, 2:59 AM #6
And not if you're using a well-configured implementation of PHP.. it has a run limit of 30 seconds if that kinda thing happens :P

------------------
Go To: HL2Central - The only HL2 site run by massassians and ex-massassians.

My turnips listen for the soft cry of your love. My insides turn to celery as I unleash my warm and sticky cauliflower of love.
Visit: Alcopedia.net the Alcoholic Encyclopedia

The user formerly known as EL3CTRO.
2004-06-06, 3:27 AM #7
Way back in school, I did something like this using some PASCAL program, maybe even using BASICA, and I created an infinite loop by accident. The teacher had to halt the current lesson, and teach us how to get out of something like that. Funny... [http://forums.massassi.net/html/biggrin.gif]

------------------
I am a nobody, and nobody is perfect; therefore, I am perfect.

Everyday I beat my own previous record for number of consecutive days I've stayed alive.

[url="mailto:Bruintone@netscape.net"]mailto:Bruintone@netscape.net[/url]Bruintone@netscape.net</A>
Yahoo! Name : jedibruintone77
I am a nobody, and nobody is perfect; therefore, I am perfect.

Everyday I beat my own previous record for number of consecutive days I've stayed alive.

My Canada includes Beavers.
2004-06-06, 3:57 AM #8
When I was trying to program an asteroids clone in Visual Basic, I accidentally filled the memory and caused a bluescreen using some DLL... And I think I almost did it twice.

------------------
MadQuack has a signature.
I'm just a little boy.
2004-06-06, 4:02 AM #9
My friend in high school created this infinte loop that created 256 directory tree and made the last one readonly. Crashed the server and he got suspended from computer access. Back in those days, the server ran off of MS-DOS 3.3 Bad Times

------------------
I'm sorry, you must be lost... I think you really don't belong here.
Email me
2004-06-06, 5:11 AM #10
while (true) { } Is the best loop EVER.
2004-06-06, 8:49 AM #11
I've crashed from cogging JK soo many times [http://forums.massassi.net/html/biggrin.gif]
But then again cogging was one of my primary investments of time for several years, so i had lots of opportunities.

------------------
[Blue Mink Bifocals !] [fsck -Rf /world/usr/] [<!-- kalimonster -->] [Capite Terram]
"If all those usefull inventions that are lyable to abuse, should therefore be concealed, there is not any Art or Science, which might be lawfully profest."
-John Wilkins, Mercury, or the Secret and Swift messenger, shewing how a man may with privacy and speed Communicate his thoughts to a Friend at any distance (London, 1641)
NPC.Interact::PressButton($'Submit');
Also, I can kill you with my brain.
2004-06-06, 9:07 AM #12
The *cough*Java*cough* compiler Ready to Program has a "stop" button [http://forums.massassi.net/html/smile.gif] -- I don't need to worry.

I haven't done any cog while-loops except "while(1)", for a broken light cog. I usually use for-loops.

------------------
for(i = 0; i < 00; i = i + 1) Print("massassi is good");
PrintInt(i); //print the integer value of infinity (if we ever get there)
May the mass times acceleration be with you.
2004-06-06, 9:27 AM #13
In PHP I use foreach loops as if they were going out of style- and they might be.
2004-06-06, 9:35 AM #14
I was once programming my Tetris game in VB for a good two hours.. ran it.. Infinite loop. Much cryage.

If anyone knows a way to get out of one in Microsoft Visual Studio 6.0... Tell me and I'll send you all my love every day in a letter, sealed with a kiss.

------------------
[16:38] Correction: dick tracy was a real man
[16:38] happydud: Actually...
[16:38] happydud: He wasn't. :D

[19:08] Dormouse: hi, my name's happydud and i'm passive-aggress.. SHUTUP!! *stabs nearby orphan*
[You have gained 3 Dark Side Points]
My Parkour blog
My Twitter. Follow me!
2004-06-06, 10:08 AM #15
Code:
#define EVER ;;

for (EVER) { //Statements }


------------------
Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.
Code to the left of him, code to the right of him, code in front of him compil'd and thundered. Programm'd at with shot and $SHELL. Boldly he typed and well. Into the jaws of C. Into the mouth of PERL. Debug'd the 0x258.
2004-06-06, 10:10 AM #16
Hm, this doesn't seem to be too much of a problem for me. If you are using an interperated language (python, perl...) you can just run it from a terminal and press ctl+c if it messes up.

------------------
I check my e-mail.
2004-06-06, 2:00 PM #17
I think I speak for the programmers amongst us when I say: "any type of loop that isn't properly/logically implemented, can be an absolute bia*ch!" [http://forums.massassi.net/html/biggrin.gif] - and ditto Dor's comments [http://forums.massassi.net/html/wink.gif]

Java - good old Java [http://forums.massassi.net/html/wink.gif] - has provided me with it's fair share of crashes, courtesy of arrays and loop-based implementations, often only at runtime. Yep - runtime errors are the real bain of programmer's lives (oxymoron? [http://forums.massassi.net/html/wink.gif]) "bypassing" the compiler's syntax checking... and then bomb you out of the program (or worse-case - hang the system) [http://forums.massassi.net/html/redface.gif]

My advice - stay away from "while" loops unless you know what you're doing (and you've got no work to lose if it crashes [http://forums.massassi.net/html/biggrin.gif])

-Jackpot

------------------
"lucky_jackpot is the smily god..." - gothicX

"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
("Ye Wearie Wayfarer" - by Adam Lindsay Gordon)

And he's finally off the starting grid --> Zooooom -@%
"lucky_jackpot is the smily god..." -gothicX
"Life is mostly froth and bubble, but two things stand in stone,
Kindness in another's trouble, courage in your own"
- "Ye Wearie Wayfarer"
|| AI Builder: compatible with both JK & MotS || My website ||
2004-06-06, 2:32 PM #18
I created a mostly infinite loop when programming my TI-83. USed a randomizer. little did i know that it only went up to about 3, tops. tried to run a problem with a solution of 9 or something. Luckily, the TI-83s will shut down a program if it doesn't complete in a set amount of time.

------------------
"No good can ever come from staying with normal people"
-Outlaw Star
"Some people play tennis. I erode the human soul"
-Tycho, Penny Arcade
"I'm a Cannabal-Vegitarian. I will BBQ an employee if there is no veggie option"
-DX:IW
A Knight's Tail
Exile: A Tale of Light in Dark
The Never Ending Story²[/i]
A Knight's Tail
Exile: A Tale of Light in Dark
The Never Ending Story²
"I consume the life essence itself!... Preferably medium rare" - Mauldis

-----@%
2004-06-06, 3:11 PM #19
Eh, are you sure about that? I've run an infinant loop for a pretty long time on an 83 before... [http://forums.massassi.net/html/tongue.gif]

Anyway, if you ever get stuck in a loop you know you can press the on button to break the running process, right?

------------------
Do you have stairs in your house?
Do you have stairs in your house?
2004-06-06, 3:51 PM #20
Quote:
<font face="Verdana, Arial" size="2">Originally posted by happydud:
I was once programming my Tetris game in VB for a good two hours.. ran it.. Infinite loop. Much cryage.

If anyone knows a way to get out of one in Microsoft Visual Studio 6.0... Tell me and I'll send you all my love every day in a letter, sealed with a kiss.
</font>
Can't you just ctrl+break? That's what I use in Visual Basic. I hate while loops. Do everything I can to avoid them.



------------------
Death awaits you with a pancake on its head.
2004-06-06, 3:56 PM #21
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Correction:
Eh, are you sure about that? I've run an infinant loop for a pretty long time on an 83 before... [http://forums.massassi.net/html/tongue.gif]

Anyway, if you ever get stuck in a loop you know you can press the on button to break the running process, right?

</font>


No, i didn't know that. I'll have to remember that, although i've never made a loop again. Also, mine gaev me some fort of memory error when i ran that program. i figured it jsut repeated so much it filled out the memory of soemthing.

------------------
"No good can ever come from staying with normal people"
-Outlaw Star
"Some people play tennis. I erode the human soul"
-Tycho, Penny Arcade
"I'm a Cannabal-Vegitarian. I will BBQ an employee if there is no veggie option"
-DX:IW
A Knight's Tail
Exile: A Tale of Light in Dark
The Never Ending Story²[/i]
A Knight's Tail
Exile: A Tale of Light in Dark
The Never Ending Story²
"I consume the life essence itself!... Preferably medium rare" - Mauldis

-----@%
2004-06-06, 3:58 PM #22
I was programming Patch Enforcer for mIRC and I accidently put in an infinite loop into the gob reader. The program kept looping through the same file over and over again. In mIRC, it locks up everything related to mIRC, then when you close it, it proceeds to lag up everything for a little while after.

------------------
A computer's worst nightmare:
0010111010011110210011010001
A computer's worst nightmare:
0010111010011110210011010001

HazTeam Website-=HT=
2004-06-06, 4:12 PM #23
The only time I have infinite loops is if I'm lazy and I use break to get out of it. Other than that, sorry, I can't sympathize.

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2004-06-06, 4:50 PM #24
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Emon:
The only time I have infinite loops is if I'm lazy and I use break to get out of it. Other than that, sorry, I can't sympathize.

</font>


Because you are an awesome programmer [http://forums.massassi.net/html/rolleyes.gif]

------------------
In Tribute to Adam Sliger. Rest in Peace

10/7/85 - 12/9/03
In Tribute to Adam Sliger. Rest in Peace

10/7/85 - 12/9/03
2004-06-06, 5:06 PM #25
No because I have something else that breaks before I get an infinite loop. [http://forums.massassi.net/html/tongue.gif]

------------------
Bassoon, n. A brazen instrument into which a fool blows out his brains.
Bassoon, n. A brazen instrument into which a fool blows out his brains.
2004-06-06, 5:15 PM #26
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Noble Outlaw:
No, i didn't know that. I'll have to remember that, although i've never made a loop again. Also, mine gaev me some fort of memory error when i ran that program. i figured it jsut repeated so much it filled out the memory of soemthing.

</font>


If it overflowed, that means it was given a calculation with a result larger than what the calculator can process... otherwise, yeah it could have run out of RAM I suppose but that usually takes a while for me :x I guess it depends on how much you have stored on the calculator, too... plus I did have this one dots game I made once... used to eat up TI ram like mad for some reason [http://forums.massassi.net/html/tongue.gif]

(oh hey look, a five digit post count! [http://forums.massassi.net/html/biggrin.gif])

------------------
Do you have stairs in your house?

[This message has been edited by Correction (edited June 06, 2004).]
Do you have stairs in your house?
2004-06-06, 7:06 PM #27
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Jedi Legend:
In PHP I use foreach loops as if they were going out of style- and they might be.</font>


.. I forgot they even existed .. bah ..

------------------
Sigs are for n00bs.

[1337 FRNDS_Pommy | 3.14 of 14 | » And-GTx2]
Half-Life 2 Central - your definitive source for everything HL2!
一个大西瓜
2004-06-06, 9:45 PM #28
foreach rocks in both php and perl

------------------
EvilMagic.net: Brian's Web Log
2004-06-07, 5:29 AM #29
'Step-into' in VB is fantastic, makes debugging so much easier.
"The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. " - Bertrand Russell
The Triumph of Stupidity in Mortals and Others 1931-1935
2004-06-07, 10:16 AM #30
Every programming book that I've ever read specifically states what to do if you find yourself caught in an endless loop, before you even start coding loops.

------------------
www.MentatMM.com (status = down :/)
Napalm Death Squad (status = alpha)
2004-06-07, 10:27 AM #31
Typically if you press the pause/break key or ctrl + (hotkey) or F8 it will take you out of your code and take you to a debugger mode. The hotkey itself is diffrent for every compiler but typically you can enter debug mode and that will abort the corrupt lines of code.

------------------
<Outlaw_Torn> you mean your related to that damned sasquatch, Mech?
<MechWarrior> Lets just say the part of the family tree that does fork has bossy the goat in it.

<ubuu> does hitler have a last name?
2004-06-07, 10:35 AM #32
Because of habit, I look over my loops before I compile the code and execute it, so I rarely face a problem them. But honestly, while loops are one of the easier problems to deal with when programming in a language like C++.

------------------
"It has become appallingly obvious that our technology has exceeded our humanity."

-Albert Einstein
2004-06-07, 10:46 AM #33
The only time I ever get infinite loops if I get silly and forget to include
i = i + 1;
or something.
"The trouble with the world is that the stupid are cocksure and the intelligent are full of doubt. " - Bertrand Russell
The Triumph of Stupidity in Mortals and Others 1931-1935
2004-06-07, 12:33 PM #34
Quote:
<font face="Verdana, Arial" size="2">Originally posted by Correction:
If it overflowed, that means it was given a calculation with a result larger than what the calculator can process... otherwise, yeah it could have run out of RAM I suppose but that usually takes a while for me :x I guess it depends on how much you have stored on the calculator, too... plus I did have this one dots game I made once... used to eat up TI ram like mad for some reason [http://forums.massassi.net/html/tongue.gif]</font>


Well, i ahve a ton of stuff on my calc, around 25 programs, every single one my own creation. So, yah. it probably overflowed. my program i was running wasn't that large, its was jsut a test program for that string, but it did run for a rather long time (20 seconds at least)

------------------
"No good can ever come from staying with normal people"
-Outlaw Star
"Some people play tennis. I erode the human soul"
-Tycho, Penny Arcade
"I'm a Cannabal-Vegitarian. I will BBQ an employee if there is no veggie option"
-DX:IW
A Knight's Tail
Exile: A Tale of Light in Dark
The Never Ending Story²[/i]
A Knight's Tail
Exile: A Tale of Light in Dark
The Never Ending Story²
"I consume the life essence itself!... Preferably medium rare" - Mauldis

-----@%
2004-06-07, 7:32 PM #35
Usually it is impossible to have a infinite loop with a for-loop but I think if you code something like this:

for(i=0; i<2; i++)
{
i = 0;
}

...it would NEVER which the condition to end so it would loop forever until the program crashes/freezes, halts, or runs out of memory.

-- SavageX

------------------
"...and if you don't like that, then you need to be slugged in the face repeatedly, until my hands are soaked in blood. Have a nice day!"
http://geocities.com/savagex378
The cake is a lie... THE CAKE IS A LIE!!!!!

↑ Up to the top!