HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

H2S?

05-10-2006, 03:27 AM#1
FatalError
I know about the return bug and all that good stuff, and I've been using it a lot lately. Now, I've looked at a lot of codes lately, and I've noticed that no one uses an H2S function, but instead uses I2S(H2I()). Is there a reason for this? Would this not work...?
Collapse JASS:
function H2S takes handle h returns string
    return h
    return ""
endfunction

I'm just wondering because from what I know of the return bug, it should work, but no one has done this, even thought it would be faster.
05-10-2006, 03:37 AM#2
Vexorian
There is a big difference between converting handle to int and converting int to string.

If you do handle to string thing it will try to use the memory address pointed by handle as a string.

It will crash for sure

instead I2S(H2I()) will make a string whose contents are the integer version of the memory address of the handle
05-10-2006, 04:50 AM#3
FatalError
Quote:
Originally Posted by Vexorian
There is a big difference between converting handle to int and converting int to string.

If you do handle to string thing it will try to use the memory address pointed by handle as a string.

It will crash for sure

instead I2S(H2I()) will make a string whose contents are the integer version of the memory address of the handle
Ah, I understand now...thanks!
05-10-2006, 02:35 PM#4
MaD[Lion]
memory is nothing more than digits ...