Question about 'static' -
dusk - 24.07.2013
I only recently learned that they "static" variables don't loose their value between calls.
And i instantly thought: gates! They're just perfect for them! Becaus I hate having global variables for them...
But someone should have thought of that....
Getting to the question part,
are there downsides to them? Are they somehow worse than global ones? Should I or should I not use them?
ANY feedback will be appreciated
Re: Question about 'static' -
Parker_Daley - 24.07.2013
I'm my opinion I wouldn't use them, they are a hastle. -- But it's what you want to.
Re: Question about 'static' -
dusk - 24.07.2013
Quote:
Originally Posted by Parker_Daley
I'm my opinion I wouldn't use them, they are a hastle. -- But it's what you want to.
|
That's the thing, i want a reason, why wouldn't you use them?
Re: Question about 'static' -
Parker_Daley - 24.07.2013
I just think they are a inconvenience.
Re: Question about 'static' -
dusk - 25.07.2013
bump
Re: Question about 'static' -
Roko_foko - 25.07.2013
Static variables are global variables that you can use only in specific block.
If you want to make a global variable that exists only between { and } use static.
If you want to use the variable outside use normal global.
I would use static for gates. Why? When I use static, outside the block I can declare another variable with same name without getting warnings.
Re: Question about 'static' -
GWMPT - 25.07.2013
static variables are almost the same thing was local variables, the unique difference is that the variable is not deleted after executing the function, so, you can use the content of the variable when you run that function again. [talking about the static local]
@Edit ->
https://sampwiki.blast.hk/wiki/Scripting...s#static_local
Re: Question about 'static' -
Misiur - 25.07.2013
Also global static exists only for single file, and won't be visible in other files namespace