Raised This Month: $32 Target: $400
 8% 

Command Targeting Plus


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-02-2017 , 12:06   Re: Command Targeting Plus
Reply With Quote #41

Why in the world every single variable is static? Revert that change.
__________________

Last edited by HamletEagle; 03-02-2017 at 12:06.
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-02-2017 , 13:37   Re: Command Targeting Plus
Reply With Quote #42

Well, a bird told me that variables should be assigned as static when they are used often.
Can you please explain why this isn't correct, because I really have no clue who to trust about this.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 03-02-2017 , 14:06   Re: Command Targeting Plus
Reply With Quote #43

Quote:
Well, a bird told me that variables should be assigned as static when they are used often.
This bird gave you just a part of the information. We should see what "often" really mean. Making them static only worth if the function is called per frame(i.e PreThink, AddToFullPack, CmdStart, etc) or if you are working with very big arrays(so you don't overflow anything).
Even if you have a task that repeats at 1.0 seconds and only small arrays static is not needed.
You could also use static on a global variable if you work with multiple files(i.e custom includes) and you want a variable to be accesible only in the scope of the file in which it was create.

Using static in other cases is pretty much over-optimization and for the sake of good practices let's use new.
__________________

Last edited by HamletEagle; 03-02-2017 at 14:09.
HamletEagle is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 03-02-2017 , 15:30   Re: Command Targeting Plus
Reply With Quote #44

I see. Thanks.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
Reply


Thread Tools
Display Modes

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 18:58.


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