Scipting dilema( just for talk )
#1

I have one dilemma what is faster and smarter to do , and why?
I more interested in why?

Example 1:
Код:
stock foo(playerid,param1,param2[])
{

new Local_Variable[512];
// some code use Local_Variable
// and more code
}
Example 2:
Код:
new Global_Variable[512];

stock foo(playerid,param1,param2[])
{

// some code use Global_Variable
// and more code
}
What is bather to do use one global variable for every or create local then use it ?
Which one take less resource?
And do you need to destroy local variable after use or is automatic ?
Reply
#2

For me, the first one, why? because if you want to use that variable again (same variable name) you could still use it and edit the size of i, sometimes includes might have the same variable name it would give you a warning
pawn Код:
warning 219: local variable "VarName" shadows a variable at a preceding level
, so, I rather stay with the first one.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)