Raised This Month: $ Target: $400
 0% 

Question Infinite loop


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 12-29-2014 , 14:36   Question Infinite loop
Reply With Quote #1

Hello, well how can i know, if some parts of code does the infinite loop, anyone can give me an Example of a infinite loop ?, it will be helpfull for me to prevent this. thnx
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 12-29-2014 , 14:38   Re: Question Infinite loop
Reply With Quote #2

for( ; ; )
client_print( 0, print_chat, "LOOOOOPYYYY" );

But I guess that would crash the server or create mad lag.

Or when you make smth like
X = 3

while( x >= 2 )
{
//execute stuff
x++;
}

Last edited by Kazalu; 12-29-2014 at 14:39.
Kazalu is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 12-29-2014 , 14:46   Re: Question Infinite loop
Reply With Quote #3

Quote:
Originally Posted by Kazalu View Post
for( ; ; )
client_print( 0, print_chat, "LOOOOOPYYYY" );

But I guess that would crash the server or create mad lag.

Or when you make smth like
X = 3

while( x >= 2 )
{
//execute stuff
x++;
}
Ok, thnx ... any other example ?
__________________
ghost95v is offline
Send a message via Skype™ to ghost95v
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 12-29-2014 , 14:49   Re: Question Infinite loop
Reply With Quote #4

while(true);


This is a generic question with many answers. Give us more specific details about what you are trying to accomplish
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou is offline
ghost95v
Senior Member
Join Date: Apr 2014
Location: somewhere in universe
Old 12-29-2014 , 14:58   Re: Question Infinite loop
Reply With Quote #5

Quote:
Originally Posted by YamiKaitou View Post
while(true);


This is a generic question with many answers. Give us more specific details about what you are trying to accomplish
i just want to understand when some part of code will give a infinite loop .Well for eg. on this code below, how it might be to give a infinite loop?

PHP Code:
bool:isInMenu(id)
{
    for (new 
0g_mapVoteNum; ++a)
        if (
id == g_nextName[a])
            return 
true
    
return false

__________________

Last edited by ghost95v; 12-29-2014 at 14:59.
ghost95v is offline
Send a message via Skype™ to ghost95v
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 12-29-2014 , 14:49   Re: Question Infinite loop
Reply With Quote #6

Do you want an example or do you want to know the use of an infinite loop?
Kazalu is offline
Kazalu
Senior Member
Join Date: Dec 2013
Location: Romania
Old 12-29-2014 , 15:00   Re: Question Infinite loop
Reply With Quote #7

When g_mapVoteNum < 0 I guess
Kazalu is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 15:29.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode