Raised This Month: $ Target: $400
 0% 

returning values


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 05-05-2006 , 08:53  
Reply With Quote #4

Quote:
Originally Posted by Suicid3
if you just use return it would be the same as using return PLUGIN_CONTINUE
Not exactly the same.

return; alone suggests that the function has no return value - it only suggests that you want to stop execution of the function. The fact that this acutally returns a zero (which, by chance, is what PLUGIN_CONTINUE is defined to) when used in a public function is an implementation detail.

Basically:
If a function has a return value (for your own (stock) function you can decide yourself, for public functions the host aplication (=AMXX) decides*), you should always use
Code:
return something
and also place such a return statement as the last one in the function (otherwise the compiler will moan).

If the function doesn't have a return value, it's not neccessary (and not encouraged) to put a single return at the end; and if you want to exit the function immediately, use
Code:
return


*) technically, all public functions have return a value to the host application. However, the host application can decide to ignore it. In that case the programmer should treat that function as a function without a return value - unless he wants to call it from his own code and return something; that's pretty unlikely though ;o
__________________
hello, i am pm
PM is offline
 



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 05:12.


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