Home » U++ Library support » U++ Core » StrIntValue -> uses int64
StrIntValue -> uses int64 [message #17805] |
Fri, 29 August 2008 17:27 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
I ran into a snag when using StrIntValue(). I assumed it stored an int, but it in fact uses int64. I had a few moments of confusion because of this. I suggest we have 2 functions, one StrIntValue() that uses int type and StrInt64Value() that uses int64 type so that others aren't confused. In the end, I just ended up using Value(StrInt(num)) instead of StrIntValue(num).
|
|
|
|
Re: StrIntValue -> uses int64 [message #17822 is a reply to message #17810] |
Sat, 30 August 2008 01:40 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
Example:
Value my_value = StrIntValue("5");
//...
int val = ValueTo<int>(my_value);
I expected this to work, but it didn't. Gave me errors about int64...
Quote: | (Hm, would it be a good idea if conversions checked this and returned Null in such case?).
|
Not sure, on one hand, I knew where to look because it had the error, but on the other hand, returning Null would stop error from happening in program.
[Updated on: Sat, 30 August 2008 01:42] Report message to a moderator
|
|
|
Re: StrIntValue -> uses int64 [message #17823 is a reply to message #17822] |
Sat, 30 August 2008 01:51 |
captainc
Messages: 278 Registered: December 2006 Location: New Jersey, USA
|
Experienced Member |
|
|
What about automatic up-conversion to int64 if string is deemed to be too large for int?
Then, ValueTo<int> would be Null and ValueTo<int64> would be fine. The user can check the Value's type with the usual my_value.Is<int>().
[Updated on: Sat, 30 August 2008 01:55] Report message to a moderator
|
|
|
|
Goto Forum:
Current Time: Fri Sep 20 19:33:22 CEST 2024
Total time taken to generate the page: 0.05043 seconds
|