AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Static Functions (https://forums.alliedmods.net/showthread.php?t=121618)

Drak 03-17-2010 18:51

Static Functions
 
Code:
static BigFunction() { }

Compared too:
Code:
BigFunction() { }

Would there be any performance difference?

Seta00 03-17-2010 19:45

Re: Static Functions
 
Quote:

Originally Posted by Pawn Language Guide
• Static functions
When the function name is prefixed with the keyword static, the scope of
the function is restricted to the file that the function resides in.
The static attribute can be combined with the “stock” attribute.

So no, no performance difference.

Arkshine 03-17-2010 19:57

Re: Static Functions
 
So, writting Function() is the same as static Function(), it would be implicit by default.

Seta00 03-17-2010 21:13

Re: Static Functions
 
Quote:

Originally Posted by Arkshine (Post 1120931)
So, writting Function() is the same as static Function(), it would be implicit by default.

EDIT: Nevermind, AMXx compiler ignores section directives :roll:

No:
PHP Code:

static Function() { server_cmd("exit"); }
#section gaben
// oh my gosh my function is lost! 

Quote:

Originally Posted by Pawn Language Guide
#section name
Starts a new section for the generated code. Any variables and
functions that are declared “static” are only visible to the section
to which they belong. By default, each source file is a separate
section and there is only one section per file.
With the #section directive, you can create multiple sections in a
source file. The name of a section is optional, if it is not set, a unique
identifier for the source file is used for the name of the section.
Any declared section ends automatically at the end of the file.


Styles 03-18-2010 02:31

Re: Static Functions
 
No but static is mostly useless in relation to plugins since there are no classes.


All times are GMT -4. The time now is 08:43.

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