What kind of variables are better?
#1

Hello, I got confused with something, maybe this is a stupid question but which script of the following ones is better? I'm talking about the memory used due the variables.

pawn Код:
stock FunctionA() {
    new string[128];
    format(string, 128, ...........................);
}

stock FunctionB() {
    new string[128];
    format(string, 128, ...........................);
}

stock FunctionC() {
    new string[128];
    format(string, 128, ...........................);
}

//As you see, I declared 3 variables with 128 cells.
Ok, that's one, what about next one:
pawn Код:
new string[128];

stock FunctionA() {
    format(string, 128, ...........................);
}

stock FunctionB() {
    format(string, 128, ...........................);
}

stock FunctionC() {
    format(string, 128, ...........................);
}

//Just one variable declared.
So, as you saw in the first one I declared 3 variables, and in the second one just one variable. My question is which one is better and why?

Thank you for helping, also, if you give me some reasons about why one of them is better I'll be grateful.

Thank you all!
Reply
#2

Thank you ******, always helping, solved.

PD: also, thank you for the suggestions.
Reply
#3

Quote:
Originally Posted by ******
Посмотреть сообщение
6) Generally you shouldn't use "stock" (irrelevant to the question, but important anyway).
May I know why?
Reply
#4

Thank you for bringing us all this information ******.

Regards.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)