SA-MP Forums Archive
is it ok to use global str ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: is it ok to use global str ? (/showthread.php?tid=500095)



is it ok to use global str ? - carl0o0s - 11.03.2014

on top

new GlobalStr[1024]

so its ok if i use that str to all format(GlobalStr,sizeof(GlobalStr)
?


Re: is it ok to use global str ? - SkilledMaster - 11.03.2014

Yes.....


Re: is it ok to use global str ? - MP2 - 11.03.2014

No, you shouldn't, because it doesn't need to be, and it can cause problems. You should only make variable global if they NEED to be global, not just because it's easier.


Re: is it ok to use global str ? - Stinged - 11.03.2014

Length 1024 is useless memory use.
So I think you should make a new string every time you need it.


Re: is it ok to use global str ? - MP2 - 11.03.2014

It's not just about memory usage. Strings can become lost - replaced by others.