13.11.2009, 21:27
Hello, I've got a question, as I'm not very fluent when it comes to pawn.
What would be the difference between using new; and static; ?
for instance
say I want to create a variable that will be used by almost every command (like in strtok / cmd,tmp)
so: new cmd[256], tmp[256];
I know that using strtok and cmd/tmp with 256 is way too much, but dont tell me, i've been told 201 times.
so, lets say after that, I took out new, and put:
static cmd[256], tmp[256];
I noticed when i did this, that heap file / code size stuff you see in the compiler dissepeared, as I have wanted it to, but what I didnt know, is how static is used, and if I am using it in the right way, or in the wrong way.
What would be the difference between using new; and static; ?
for instance
say I want to create a variable that will be used by almost every command (like in strtok / cmd,tmp)
so: new cmd[256], tmp[256];
I know that using strtok and cmd/tmp with 256 is way too much, but dont tell me, i've been told 201 times.
so, lets say after that, I took out new, and put:
static cmd[256], tmp[256];
I noticed when i did this, that heap file / code size stuff you see in the compiler dissepeared, as I have wanted it to, but what I didnt know, is how static is used, and if I am using it in the right way, or in the wrong way.