28.12.2016, 20:12
Hello,
I have never ever used statics, so i was asking myself if i could do this, furthermore, what would you say is better?
So for example, i have this code:
I am using this code to clear all strings in an array.
Looking at this code we can see, that every time it is called the size of "deadPlayers" will be retrieved.
So, if this code would be called very often (let us just say 200 times a second), should i do this instead?:
Just an example tho, no productive code
I have never ever used statics, so i was asking myself if i could do this, furthermore, what would you say is better?
So for example, i have this code:
PHP код:
for(new i = 0, j = sizeof(deadPlayers); i < j; i++)
{
deadPlayers[i] = "";
}
Looking at this code we can see, that every time it is called the size of "deadPlayers" will be retrieved.
So, if this code would be called very often (let us just say 200 times a second), should i do this instead?:
PHP код:
static deadPlayersSize = sizeof(deadPlayers);
for(new i = 0; i < deadPlayersSize; i++)
{
deadPlayers[i] = "";
}
