Should blitz determine type needed w/ #'s?
BlitzMax Forums/BlitzMax Beginners Area/Should blitz determine type needed w/ #'s?
| ||
Well, after dicking around for 20 minutes trying to figure out why a long variable couldn't hold the max value of an unsigned int - and why it was returning -1, I realized that in my assigment statement I needed to specify the type of the value. In other words const MaxIntVal:long = 4294967295 gave MaxIntVal a value of -1, whereas const MaxIntVal:long = 4294967295:long gave the expected results. Shouldn't Blitz automatically convert the value (especially in a const statement as I was using) to the variable type, if no date would/could be truncated/lost? |
| ||
Isn't this the same with C with the L UL ULL suffixes? I do agree if the variable/constant is declared on the same line as its assignment the compiler should to do this automatically. |
| ||
Mark said he will fix this next release http://www.blitzbasic.com/Community/posts.php?topic=63878#713203 |
| ||
Awesome. Good to hear it! |
| ||
Actually, the little test I wrote up didn't use const. I found a new error - it appears you can't have a long const. this code Strict Const const_long:Long = 4294967295:Long Global big_long:Long = 4294967295:Long Print "Const_long =" + const_long Print "Big_long =" + big_long gives me this output Const_long =-1 Big_long =4294967295 |
| ||
Id Post that in the bug report section |
| ||
just did! |
| ||
Yep, definitly shouldnt do that in strict without a conversion warning. You are right in that maybe you cannot have a long const. But Ive never heard that |
| ||
Works on the Linux version of BlitzMax, I get 4294967295 for both. Haven't tried the Windows version, could possibly be a Windows bug? |