Am I doing something wrong if I do this with my vars?
#1

Hi all,
I'm not sure if I'm being smart here or if I'm doing a mistake, so i thought I'd ask you guys.

I tried simplifying some variables like so:

Before:
Код:
UsefullFunction() 
{
    new sqlquery[512];
    format(sqlquery, sizeof(sqlquery), "SELECT ETC");
    //code that uses 'sqlquery' var.
}
UsefullFunction2etc() 
{
    new sqlquery[512];
    format(sqlquery, sizeof(sqlquery), "SELECT AND ALL");
    //code that uses 'sqlquery' var.
}
After:
Код:
new sqlquery[512];

UsefullFunction() 
{
    format(sqlquery, sizeof(sqlquery), "SELECT ETC");
    //code that uses 'sqlquery' var.
}
UsefullFunction2etc() 
{
    format(sqlquery, sizeof(sqlquery), "SELECT AND ALL");
    //code that uses 'sqlquery' var.
}
I figured that since the CPU can only execute one thing at a time, it can only be executing one function at a time.
Therefore if I always use this variable to immediately format and use it at the same 'time' then it's a good solution?
I don't see any problems at this time and I think multi-threading is not a possibility for SAMP Servers.

Thank you in advance for your opinions.
rt-2
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)