Posts: 694
Threads: 2
Joined: Oct 2012
Reputation:
0
Neither (or rather negligible?), static stays in memory for further usage, while everytime you leave the code block a variable belongs to, a 'new' variable gets removed from memory, therefore re-allocating that space every time you call it.
Statics are mostly used when the code is under a heavily repetitive callback, so it won't remove and recreate the var 20 times a sec for example.
As a rule of thumb, if you don't know why static is useful here, just don't use it, use new everywhere!
Posts: 4,759
Threads: 33
Joined: Dec 2013
Reputation:
0
Also: static variables can't be used outside the file.