Forum Discussion

renojim's avatar
renojim
Community Streaming Expert
9 years ago

Working with LongInteger

I'm just taking a look at roLongInteger. As far as I can tell, it suffers from the same shortcoming as roDouble. Namely, there's no way to go back and forth to/from strings. Am I missing something? I have some monotonically increasing values that I'm worried will eventually overflow 32-bits. Currently I store them in the registry using toStr() and then use toInt() to convert the string back to an integer. There's no toLongInt() that I've found.

When I ran across this issue with doubles, I used Eval. The same thing could be done for LongInts:
BrightScript Debugger> lintstr = "8589934592&"
BrightScript Debugger> Eval("x& = " + lintstr)
BrightScript Debugger> ?type(x&), x&
LongInteger 8589934592

Now I've been told that Eval has been deprecated and also leaks memory. So... am I missing something simple? Is there really a problem if I use Eval a half a dozen times or so at the beginning of my code and then never again until it exits?

-JT

15 Replies