stocks and forwards
#1

What's the difference when creating a function with either
pawn Код:
stock FunctionName(OptinalParameters[])
or with
pawn Код:
forward FunctionName(OptionalParameters[]);
public FunctionName(OptionalParameters[])
Is one faster and why is there 2 ways of doing this, and why do some use stock and some forwardings & public?
Reply
#2

Public functions can be called from any script, while stock functions are limited to the script in which they are located.
Reply
#3

Also you can access a public function using a timer but you can't access stocks (as far as I know). As for the speed I'm not sure which is faster.
Reply
#4

Quote:
Originally Posted by SpiritEvil
Посмотреть сообщение
Also you can access a public function using a timer but you can't access stocks (as far as I know). As for the speed I'm not sure which is faster.
Stock Functions.
Reply
#5

Quote:
Originally Posted by T0pAz
Посмотреть сообщение
Stock Functions.
Then I don't understand why people use forwards in their single filterscripts. Just stupid.
Reply
#6

Quote:
Originally Posted by CookieJar
Посмотреть сообщение
Then I don't understand why people use forwards in their single filterscripts. Just stupid.
Because some people doesn't know the difference.
Reply
#7

Quote:

Stock Functions.

Thanks for correcting me :P

Quote:

Because some people doesn't know the difference.

Don't know* (people = plural)
Now we're equal
Reply
#8

Allright. Always liked stock more anyway.
Reply
#9

Quote:
Originally Posted by SpiritEvil
Посмотреть сообщение
Also you can access a public function using a timer but you can't access stocks (as far as I know). As for the speed I'm not sure which is faster.
Quote:
Originally Posted by T0pAz
Посмотреть сообщение
Stock Functions.
Have you benchmarked that? No, you didn't. Also, stock is not an initializer, but merely a modifier. It can be used with single variables as well and can be omitted for regular functions. Something like:
pawn Код:
static const stock Float:coordinates[][3] = { /* ... */ };
is not something uncommon for me to write.
pawn Код:
FunctionName(OptinalParameters[]) {}
Also works. The compiler will give a warning if the function is not used, which may or may not be more helpful.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)