Question about Scope
#1

Hello.

What is the difference between a static array of new?
Reply
#2

thats what pawn language guide is for

• Static local declarations
A local variable is destroyed when the execution leaves the compound block
in which the variable was created. Local variables in a function only exist
during the run time of that function. Each new run of the function creates
and initializes new local variables. When a local variable is declared with
the keyword static rather than new, the variable remains in existence after
the end of a function. This means that static local variables provide private,
permanent storage that is accessible only from a single function (or
compound block). Like global variables, static local variables can only be
initialized with constant expressions.
• Static global declarations
A static global variable behaves the same as a normal global variable, except
that its scope is restricted to the file that the declaration resides in. To
declare a global variable as static, replace the keyword new by static.
Reply
#3

That is, for example, as a function of creating a string[128]; better to use static?
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)