global new or static?
What is better?
PHP Code:
PHP Code:
PHP Code:
|
Re: global new or static?
well you gotta think abot what you are using it for. Global is used so that you can use it in more than one function. New is limited to only that function, as well as static.
http://wiki.amxmodx.org/Optimizing_P...atic_vs_Global |
Re: global new or static?
For arrays used in a forward called often, you better use static. 1 is the same than 3 except the scope of the var is expanded all the functions.
|
Re: global new or static?
About that document ( http://wiki.amxmodx.org/Optimizing_P...atic_vs_Global )... I can't really understand this part:
Quote:
|
Re: global new or static?
If both functions A and B use function C and C is using static variable then you might not get what expected. If A executes first then B it might not be the same as B executing first then A. The outcome of A and B might be different.
Something along those lines. It's similar to race conditions I believe. |
Re: global new or static?
Ok I got it :) Thx for answers
|
| All times are GMT -4. The time now is 22:03. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.