Raised This Month: $ Target: $400
 0% 

warning 225: unreachable code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
buzzy147
Junior Member
Join Date: Jan 2010
Old 07-10-2010 , 21:02   warning 225: unreachable code
Reply With Quote #1

..

Last edited by buzzy147; 10-08-2018 at 14:19. Reason: .
buzzy147 is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 07-10-2010 , 21:11   Re: warning 225: unreachable code
Reply With Quote #2

Anywhere you see the word 'return' in code, no code after that will be reached because the code exits the function at that line. I highlighted the lines that are unreachable. Of course you can sometimes see return PLUGIN_HANDLED (or w\e) with code after it but it is usually found within some type of conditional which will still allow code after it to be reached.

Code:
        client_print(id, print_chat, "[AMXX] Voce nao esta em uma mapa de surf.")         return PLUGIN_HANDLED         if(cs_get_user_money(id) < 7000)         {             client_print(id, print_chat, "[AMXX] Voce nao tem dinheiro suficiente.")             return PLUGIN_HANDLED             if(cs_get_user_money(id) > 7000)             {                 set_task(0.1,"open_jail",id)                 cs_set_user_money(id, cs_get_user_money(id) - 7000);             }

Example of when it can be ok for code after a return
PHP Code:
FuncBlah()
{
      if ( 
== 10 )
      {
            
//do this stuff
            
return PLUGIN_HANDLED;
      }
    
      
//Do this stuff since a was not equal to 10 and this code was reached
      
*= 55;
      return 
PLUGIN_HANDLED;

__________________

Last edited by Bugsy; 07-10-2010 at 21:14.
Bugsy is offline
buzzy147
Junior Member
Join Date: Jan 2010
Old 07-10-2010 , 21:41   Re: warning 225: unreachable code
Reply With Quote #3

..

Last edited by buzzy147; 10-08-2018 at 14:20. Reason: .
buzzy147 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 07:05.


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