• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[JASS] Integer Question

Status
Not open for further replies.
Do integers leak if you dont set them to null, because i have: x = null (x is a local var) and it keeps giving me an error message

Bottom line, integers don't leak. You may expect that as I did, but they don't leak, nor do reals. Nulling integers and reals cause problems and say that there is an error. Remember that only certain types of variables need to be nulled, which excludes the integers and reals.
@V_V_V: You can't null integers and reals... :D

I hope this helps. :emote_grin:
 
Level 11
Joined
Jul 12, 2005
Messages
764
Only handle-type variables leak. Non-handle types are:
Reals, integers, strings, booleans, umm what else?... :S
If you want to "null" them at all costs you can do it by:
set real = 0
set integer = 0
set string = ""
set boolean = false

But as i said, there's no need to do so.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,259
null is actually a constant handle value of NOTHING if you want to look at it that way.

Setting non handle based vars to null is impossiable since it is like trying to set.
JASS:
local intiger i = "DrSuperGood"

Which will ofcourse return an error. Vexorian is about the best jass programer that WC3 has seen and he never set his local non-handles to "nothing" which means that they do not leak.
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
same with

set i =

That'll just make the compiler go OMGWTFNEEDPARAMETERNUB

Anyways, any native types [boolean,string((exception here, sort of!!)),code,integer,real] don't leak, so they don't need to be nulled or destroyed.

Also, null is of type handle (or string, another exception with strings, but strings should really be handles), so any non-handle type can't be set to null
 
Level 14
Joined
Nov 20, 2005
Messages
1,156
Reals and integer variables are objects in their own right. When the variable disappears, therefore, the object disappears. Thus they cannot leak.

H2I(null) gives 0x100000 or something I think. Just a value. But you can't set real or integer variables to null.

Strings leak, but that is only when new, unique strings are created, and is unstoppable (but may be avoided).

Code variables cannot leak.
 
Status
Not open for further replies.
Top