- Joined
- Aug 1, 2013
- Messages
- 4,658
Hi all.
I got this bad feeling when I do not null a local agent in functions... that are used 33 times a second for every object of that system... could be like 3300 per second for example.
But
1. Is it necessary to null returned values?
2. Is this a good solution for it?
3. Do local variables that are given as an argument also have to be nulled?
EDIT: Yes these functions are really stupid and don't do shit but that is not what it is about.
EDIT: And yes I spelled the title wrong... it should be "Nulling local variables that are returned."
I got this bad feeling when I do not null a local agent in functions... that are used 33 times a second for every object of that system... could be like 3300 per second for example.
JASS:
function GetUnit takes nothing returns unit
local unit u = AUnit()
return u
endfunction
But
1. Is it necessary to null returned values?
2. Is this a good solution for it?
JASS:
function GetUnit takes nothing returns unit
local unit u = AUnit()
set udg_TempUnit = u
set u = null
return udg_TempUnit
endfunction
3. Do local variables that are given as an argument also have to be nulled?
JASS:
function SetUnit takes unit whichUnit returns nothing
set whichUnit = null
endfunction
EDIT: Yes these functions are really stupid and don't do shit but that is not what it is about.
EDIT: And yes I spelled the title wrong... it should be "Nulling local variables that are returned."