Thread: [Tutorial] Stop the abuse of stock!
View Single Post
Old 04/05/2020, 02:57 AM   #92
Big Clucker
Join Date: May 2012
Location: Nottingham, England
Posts: 125
Reputation: 19
Default Re: Stop the abuse of stock!

So what's your reasoning for this?

Yeah, it's not required, but it suppresses errors and is not added to the compiled code if it's never called.

If I'm writing a large script with many functions, and I add to the bottom,
PHP Code:
stock CheckPlayerStats(iPlayerID) {
// do something

I can leave it there without using the function yet and it won't be compiled into the amx, but it's already written for when I do come to use it.

If I remove the 'stock' as you suggest, then I'll get an "unused" warning until I do use it, and it gets compiled into the amx regardless of whether I reference the function or not, thus potentially wasting space.

A 'stock' function does not have the potential to waste space the way a plain function does.
[FMJ]PowerSurge is offline   Reply With Quote