Last visit was: It is currently Sat Sep 23, 2023 1:52 pm


All times are UTC-05:00




Post new topic Reply to topic  [39 posts ] 
Author Message
 Post subject:
PostPosted:Sat Feb 25, 2006 1:05 pm 
Connoisseur of the Godawful
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:456
ICQ:286315965
Website:http://rabidtinker.mine.nu/
Yahoo Messenger:alistair_lynn
AOL:Agent_Vast@mac.com
Location:127.0.0.1
When things seriously go off-topic in this forums, people run for cover.

It usually ends in a Clash of the Titans where Burningmace and prophile attain mighty armies then battle it out before being tempbanned by Miah.

_________________
Alastair Lynn / Alumnus / Onlink Team


Top
Offline  
 Post subject:
PostPosted:Sun Feb 26, 2006 5:35 am 
User avatar
 

Joined:Wed Feb 01, 2006 4:28 pm
Posts:97
anybody popcorn,hotdogs or sunglasses? *waves around*

_________________
Onlink all-purpose Weapon.


Top
Offline  
 Post subject:
PostPosted:Tue Mar 07, 2006 11:21 am 
External Project Staff
User avatar
 

Joined:Sun Oct 30, 2005 3:40 pm
Posts:371
Website:http://idlesoft.net
Location:~/
Quote:
Code:
for ( int i = sqrt(-1); i < infinity; i++ );
is there a way to really make an infinite loop cuz
Code:
for (int i = 0; i < infinite; ++i)
doesn't work (error C2065: 'infinite' : undeclared identifier)

and it would be usefull in some of the things I'm creating. an infinite loop that only ends when you stop it (or never, good virus idea)

_________________
-- ChaosR

Image


Top
Offline  
 Post subject:
PostPosted:Tue Mar 07, 2006 11:52 am 
User avatar
 

Joined:Wed Feb 15, 2006 4:27 pm
Posts:63
Website:http://constablebrew.googlepages.com
Location:Southern California, USA
Code:
for(int i=0;i==i--;i++){i=0;};
Infinite loops are easy to come by. Video games are typically infinate loops. There is no variable or constant that you can refer to that holds the value of infinity. If you think about it this is because infinity is not an exact value but is instead more like a concept. Since computers only deal with exact values there is no way to represent infinity in a computer.

The easiest way to calculate infinity is to divide any number by zero.


Last edited by ConstableBrew on Tue Mar 07, 2006 12:05 pm, edited 1 time in total.

Top
Offline  
 Post subject:
PostPosted:Tue Mar 07, 2006 12:00 pm 
Connoisseur of the Godawful
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:456
ICQ:286315965
Website:http://rabidtinker.mine.nu/
Yahoo Messenger:alistair_lynn
AOL:Agent_Vast@mac.com
Location:127.0.0.1
Overcomplicating things.
Code:
for(;;) { blah(); }

_________________
Alastair Lynn / Alumnus / Onlink Team


Top
Offline  
 Post subject:
PostPosted:Tue Mar 07, 2006 12:07 pm 
User avatar
 

Joined:Wed Feb 15, 2006 4:27 pm
Posts:63
Website:http://constablebrew.googlepages.com
Location:Southern California, USA
Does that work? *thinks about it* it should... *opens up visual studio* cool!


Top
Offline  
 Post subject:
PostPosted:Tue Mar 07, 2006 3:33 pm 
 

Joined:Thu Apr 28, 2005 3:57 pm
Posts:175
AOL:DKWiz214
Some languages I know don't like that, so I use:
Code:
for(i=1;i;i) { blah(); }

_________________
The light shall be your demise.


Top
Offline  
 Post subject:
PostPosted:Tue Mar 07, 2006 4:34 pm 
Connoisseur of the Godawful
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:456
ICQ:286315965
Website:http://rabidtinker.mine.nu/
Yahoo Messenger:alistair_lynn
AOL:Agent_Vast@mac.com
Location:127.0.0.1
Quote:
*opens up visual studio*
Ew, visual studio.

Also, failing the for(;;) method there is another way:
Code:
while (true) { blah(); }

_________________
Alastair Lynn / Alumnus / Onlink Team


Last edited by prophile on Wed Mar 08, 2006 4:15 pm, edited 1 time in total.

Top
Offline  
 Post subject:
PostPosted:Tue Mar 07, 2006 6:06 pm 
User avatar
 

Joined:Wed Feb 15, 2006 4:27 pm
Posts:63
Website:http://constablebrew.googlepages.com
Location:Southern California, USA
That's even better than before!!! Oh the elegance of useless code.


Top
Offline  
 Post subject:
PostPosted:Wed Mar 08, 2006 4:16 pm 
Connoisseur of the Godawful
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:456
ICQ:286315965
Website:http://rabidtinker.mine.nu/
Yahoo Messenger:alistair_lynn
AOL:Agent_Vast@mac.com
Location:127.0.0.1
I disagree, this code is far from useless. In the main loop of a program you want to have it infinite and set the break conditions manually...

_________________
Alastair Lynn / Alumnus / Onlink Team


Top
Offline  
 Post subject:
PostPosted:Wed Mar 08, 2006 4:35 pm 
User avatar
 

Joined:Wed Feb 15, 2006 4:27 pm
Posts:63
Website:http://constablebrew.googlepages.com
Location:Southern California, USA
An infinite loop, one that has no exit, is worthless code. Normal use of loops does just as you are saying - continue looping until it is told to stop. As interesting as while(TRUE){} is, it would be very poor coding practice to use such a loop. It makes it more difficult to figure out what the loop is doing if you have to dig into it and find a break statement.

while(!quitGame){ ... } is informative and as "infinite" as it needs to be.


Top
Offline  
 Post subject:
PostPosted:Wed Mar 08, 2006 5:07 pm 
Connoisseur of the Godawful
User avatar
 

Joined:Tue Mar 01, 2005 9:00 am
Posts:456
ICQ:286315965
Website:http://rabidtinker.mine.nu/
Yahoo Messenger:alistair_lynn
AOL:Agent_Vast@mac.com
Location:127.0.0.1
I've had a few places where it's more appropriate to break from inside the loop than outside.

_________________
Alastair Lynn / Alumnus / Onlink Team


Top
Offline  
 Post subject:
PostPosted:Thu Mar 09, 2006 3:42 am 
External Project Staff
User avatar
 

Joined:Sun Oct 30, 2005 3:40 pm
Posts:371
Website:http://idlesoft.net
Location:~/
anyway, C++ isn't my programming language. with everything i make it is always shouting there's something wrong, but when I fix that, something else breaks, and when that is fixed...

you get the point.

_________________
-- ChaosR

Image


Top
Offline  
 Post subject:
PostPosted:Thu Mar 09, 2006 4:11 am 
User avatar
 

Joined:Wed Feb 01, 2006 4:28 pm
Posts:97
...you are broke from all this time you spend on fixing :>

_________________
Onlink all-purpose Weapon.


Top
Offline  
 Post subject:
PostPosted:Thu Mar 09, 2006 10:26 am 
User avatar
 

Joined:Wed Feb 15, 2006 4:27 pm
Posts:63
Website:http://constablebrew.googlepages.com
Location:Southern California, USA
ChaosR, you have the dev cd?


Top
Offline  
Display posts from previous: Sort by 
Post new topic Reply to topic

All times are UTC-05:00


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Theme created by Miah with assistance from hyprnova