Re: Stop the abuse of stock! -
introzen - 04.04.2016
Great! Didn't know this. Been taught everything from this community including Stock, so now I'll get rid of it.
Does the include part apply for ".pwn" files as well as ".inc" files? I use .pwn's as #includes.
Re: Stop the abuse of stock! -
Puppy - 05.04.2016
Quote:
Originally Posted by introzen
Great! Didn't know this. Been taught everything from this community including Stock, so now I'll get rid of it.
Does the include part apply for ".pwn" files as well as ".inc" files? I use .pwn's as #includes.
|
You shouldn't need stock if you organize your gamemode through .pwn include files(for things such as a housing system, a vehicle system, etc). If you are using an include that has certain functions available such as an include displaying additional player data(such as when they joined, their name using a variable rather than through the GetPlayerName function, etc) then most of the time a stock is appropriate since the function isn't going to always be used.
Re: Stop the abuse of stock! -
Arastair - 05.04.2016
Didn't know that, thanks vince
Re: Stop the abuse of stock! -
Itzhak E. - 07.04.2016
Any other way to return a string other than using stock?
P.s good tut.
Re: Stop the abuse of stock! -
Sew_Sumi - 07.04.2016
Quote:
Originally Posted by Itzhak E.
Any other way to return a string other than using stock?
|
Damn, if you'd read it, they're not stocks but normal functions... Functions can return anything.
You're calling them stocks, when they are actually functions, and thus, your usage of stock is more than likely incorrect.
Re: Stop the abuse of stock! -
Sasino97 - 17.04.2016
I always compared the
stock keyword in pawn to the
@SuppressWarnings("unused") annotation in Java.
Re: Stop the abuse of stock! -
iKevin - 07.06.2016
Quote:
Originally Posted by Michael@Belgium
I like to use stock, it's short to write and easy to use. Don't tell me what to do. If it works .. it works.
So you're basicly saying to always write publics and forward them ? I don't like to type much.
|
You are an idiot. Stock tells the compiler that the function may also not be used and compiler takes more time to compile the script.
Re: Stop the abuse of stock! -
vannesenn - 07.06.2016
Quote:
Originally Posted by KevinExec
You are an idiot. Stock tells the compiler that the function may also not be used and compiler takes more time to compile the script.
|
Does stock improve performance on server? I don't care on compiler
Re: Stop the abuse of stock! -
LockedLucas - 07.06.2016
Muito ъtil, parabйns.
Re: Stop the abuse of stock! -
TwinkiDaBoss - 07.06.2016
Quote:
Originally Posted by vannesenn
Does stock improve performance on server? I don't care on compiler
|
Nope
Regarding about this entire thing, I preffer to place stock at almost every function due to simple reason and that is searching. Nothing else really
Re: Stop the abuse of stock! -
Private200 - 07.06.2016
Quote:
Originally Posted by TwinkiDaBoss
Nope
Regarding about this entire thing, I preffer to place stock at almost every function due to simple reason and that is searching. Nothing else really
|
No?
Quote:
Originally Posted by vannesenn
Does stock improve performance on server? I don't care on compiler
|
Yes, it does. Just check main thread and it explains you why.
Quote:
It means you have functions which do nothing but waste your scroll wheel.
|
You are going to have a fresh script with less functions, faster gamemode loading.
Re: Stop the abuse of stock! -
SickAttack - 10.06.2016
Quote:
Originally Posted by KevinExec
You are an idiot. Stock tells the compiler that the function may also not be used and compiler takes more time to compile the script.
|
Negative, 1,326 stock functions compiles in 0.2 seconds on my PC. The difference is vastly MINOR, most people hardly have 300 functions in their gamemodes. Not to mention that 1,066 stock functions (random number, tested however) compiles in 0.1 seconds on my end.
http://pastebin.com/KB8zrs35
Quote:
Originally Posted by Private200
No?
Yes, it does. Just check main thread and it explains you why.
You are going to have a fresh script with less functions, faster gamemode loading.
|
Also negative, it's useless to point out things without prior testing. It definitely WON'T be faster, stock functions are left out of the .amx file (the file which the server uses on execution), as if they didn't exist in the source code (.pwn file).
To the date, there is no proof that using "stock" has any impact on the server's performance whatsoever, so why bother giving false claims out? Show your evidence instead.
With or without using "stock", your server WILL perform the same, and even if you have a "cluttered" gamemode (source code). However, whether having a cluttered gamemode or not depends on the programmer. I use the keyword "stock" when creating functions and in dispute of that, I do not leave unused functions laying around.
So, yeah... I do agree that when creating a function (in gamemodes and filterscripts) the keyword "stock" is not a requirement, though. BUT, when there are no differences between using it or not (as long as the user knows the keyword's purpose/use), then people should be able to use "stock" without being told otherwise.
I would also like to say something about this:
Quote:
Originally Posted by Pottus
Why even do that? Just put #define Function at the top of your script then.
Ex.
Function Test();
|
A lot of people prefer to use "stock" instead of a define due to terms of ease and laziness (for people that uses "stock" when writing functions). I don't want to be bringing/passing that define all around the place.
And dispute the fact that there is no difference in using stock or that define, so why should people do that anyway?
Re: Stop the abuse of stock! -
vannesenn - 10.06.2016
Quote:
Originally Posted by Private200
No?
Yes, it does. Just check main thread and it explains you why.
You are going to have a fresh script with less functions, faster gamemode loading.
|
Why then we should use public? I don't understand now anything.
Re: Stop the abuse of stock! -
Konstantinos - 10.06.2016
Quote:
Originally Posted by vannesenn
Why then we should use public? I don't understand now anything.
|
You miss the main point of this thread.
stock is not a MUST when writing a function as many people still think. The only thing it does is hiding the warning if the function is not used anywhere in your script.
You shouldn't use public functions without a reason as well. Use public functions only if it is called by a timer, Call Local/Remote Function or a callback specified to some functions from plugins such as mysql_tquery or mysql_pquery.
Re: Stop the abuse of stock! -
Stinged - 11.06.2016
A lot of people think normal functions are actually called stock.
stock is a word you place to hide the 'unused' warning.
It doesn't only work in functions, it also works in arrays and variables.
Code:
new stock Unused_Array[50];
Re: Stop the abuse of stock! -
SickAttack - 11.06.2016
It doesn't just only hide the warning, it also leaves unused functions out of the compiled source as if it didn't exist.
Functions with stock in front of them can/are called stock functions.
Re: Stop the abuse of stock! -
PeanutButter - 11.02.2017
Quote:
Originally Posted by Vince
What is stock?
|
Baby don't hurt me.
Re: Stop the abuse of stock! -
HydraHumza - 11.02.2017
Quote:
Originally Posted by PeanutButter
Baby don't hurt me.
|
You bump the old topic
Re: Stop the abuse of stock! - iLearner - 11.02.2017
Quote:
Originally Posted by Humza
You bump the old topic
|
I wouldnt really call it a bump, or any kind of rule break, however for the reason he did it & what he posted, is indeed unappropriated.
Re: Stop the abuse of stock! -
ATomas - 22.02.2017
From pawn documentation (
https://www.compuphase.com/pawn/pawn.htm page 86)
Quote:
Stockfunctions A “stock” function is a function that the PAWN parser must “plug into” the program when it is used, and that it may simply “remove” from the program (without warning) when it is not used.
|
Use alright stock continues happy