View Single Post
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 03-04-2018 , 09:15   Re: When should i use "static" over "new" variable?
Reply With Quote #9

Quote:
Originally Posted by E1_531G View Post
For example, we have client_prethink() which is executed every client frame.
If inside the function you use new var, you will have:
1. create var
2. use var
3. delete var (on func end)
If you have static var instead:
1. create var (only first call)
2. use var
(never delete on func end)
It doesn't matter.
__________________
klippy is offline