Raised This Month: $51 Target: $400
 12% 

[TUT] The Use of Stocks


Post New Thread Reply   
 
Thread Tools Display Modes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-18-2010 , 22:30   Re: [TUT] The Use of Stocks
Reply With Quote #11

Quote:
Originally Posted by drekes View Post
sorry for reviving a 4 year old thread, but what is the best to use? cause i don't understand it.
They both function exactly the same if and when they are called; the only difference is when you compile the plugin. A stock function is only compiled into the binary (.amxx) file if it is called at least one time in your code. If it is not called at all, the compiler does not include that function in the compiled plugin.

As BAILOPAN said, stocks are ideal for include files since they contain numerous functions, some of which may never be used by the plugin that 'included' it. This will prevent the compiled plugin from containing code that is never used\executed at all.
__________________
Bugsy is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-19-2010 , 14:18   Re: [TUT] The Use of Stocks
Reply With Quote #12

so stock ... is better if you are not sure you will use it?
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Dr.G
Senior Member
Join Date: Nov 2008
Old 04-19-2010 , 14:27   Re: [TUT] The Use of Stocks
Reply With Quote #13

Yes =)
__________________
Dr.G is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 04-19-2010 , 14:49   Re: [TUT] The Use of Stocks
Reply With Quote #14

Saying "better" means you have not understood what said Bugsy/Antibots.
__________________
Arkshine is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-19-2010 , 20:04   Re: [TUT] The Use of Stocks
Reply With Quote #15

Quote:
Originally Posted by drekes View Post
so stock ... is better if you are not sure you will use it?
There isn't necessarily a better. You shouldn't use stocks at all in a normal plugin since when you are not using a particular function you should just remove it from your code.
__________________
Bugsy is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-19-2010 , 21:01   Re: [TUT] The Use of Stocks
Reply With Quote #16

Quote:
Originally Posted by Bugsy View Post
There isn't necessarily a better. You shouldn't use stocks at all in a normal plugin since when you are not using a particular function you should just remove it from your code.
But in another point of view (I just tought about this now) if you use "stock" in a normal plugin you don't lose almost nothing (some milliseconds in compiling maybe) and gain the (questionable but anyway) benefit of marking your functions as reusable. Like, a label.
__________________
joaquimandrade is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-19-2010 , 21:33   Re: [TUT] The Use of Stocks
Reply With Quote #17

Quote:
Originally Posted by joaquimandrade View Post
But in another point of view (I just tought about this now) if you use "stock" in a normal plugin you don't lose almost nothing (some milliseconds in compiling maybe) and gain the (questionable but anyway) benefit of marking your functions as reusable. Like, a label.
Of course there are situations where stocks can be used depending on the scripters preference. I was just trying to get him to understand what a stock is.
__________________
Bugsy is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 04-19-2010 , 21:57   Re: [TUT] The Use of Stocks
Reply With Quote #18

Quote:
Originally Posted by Bugsy View Post
Of course there are situations where stocks can be used depending on the scripters preference. I was just trying to get him to understand what a stock is.
Yes sure, I just took this chance to spread this thought I had . And it makes sense for me. If anyone agree or disagree with me, please tell me
__________________

Last edited by joaquimandrade; 04-19-2010 at 22:00.
joaquimandrade is offline
drekes
Veteran Member
Join Date: Jul 2009
Location: Vault 11
Old 04-20-2010 , 03:35   Re: [TUT] The Use of Stocks
Reply With Quote #19

i am still a bit confused about this
__________________

Quote:
Originally Posted by nikhilgupta345 View Post
You're retarded.
drekes is offline
Send a message via MSN to drekes
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-20-2010 , 07:21   Re: [TUT] The Use of Stocks
Reply With Quote #20

Quote:
Originally Posted by drekes View Post
i am still a bit confused about this
Try reading the Pawn Language Guide. Search for 'stock' in the pdf.
__________________

Last edited by Bugsy; 04-20-2010 at 07:23.
Bugsy 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 06:09.


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