Raised This Month: $ Target: $400
 0% 

Static Functions


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Drak
Veteran Member
Join Date: Jul 2005
Old 03-17-2010 , 18:51   Static Functions
Reply With Quote #1

Code:
static BigFunction() { }

Compared too:
Code:
BigFunction() { }

Would there be any performance difference?
__________________
Oh yeah
Drak is offline
Send a message via MSN to Drak
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 03-17-2010 , 19:45   Re: Static Functions
Reply With Quote #2

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.
Seta00 is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 03-17-2010 , 19:57   Re: Static Functions
Reply With Quote #3

So, writting Function() is the same as static Function(), it would be implicit by default.
__________________
Arkshine is offline
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 03-17-2010 , 21:13   Re: Static Functions
Reply With Quote #4

Quote:
Originally Posted by Arkshine View Post
So, writting Function() is the same as static Function(), it would be implicit by default.
EDIT: Nevermind, AMXx compiler ignores section directives

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.

Last edited by Seta00; 03-17-2010 at 21:18.
Seta00 is offline
Styles
Veteran Member
Join Date: Jul 2004
Location: California
Old 03-18-2010 , 02:31   Re: Static Functions
Reply With Quote #5

No but static is mostly useless in relation to plugins since there are no classes.
Styles is offline
Send a message via AIM to Styles
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 08:43.


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