Code: Select all
F := {"-2146826281" : "ANYTHING"}
MsgBox F["-2146826281"] ; SHOW EMPTY STRING
MsgBox F[-2146826281] ; Cause AHK CRASH
Code: Select all
F := {"-2146826281" : "ANYTHING"}
MsgBox F["-2146826281"] ; SHOW EMPTY STRING
MsgBox F[-2146826281] ; Cause AHK CRASH
And I found some inconsistent results:v2-changes wrote:Integer constants and numeric strings outside of the supported range (of 64-bit signed integers) now overflow/wrap around, instead of being capped at the min/max value. This is consistent with math operators, so 9223372036854775807+1 == 9223372036854775808 (but both produce -9223372036854775808).
Code: Select all
MsgBox 9223372036854775807+1 == 9223372036854775808 ; "1" as expected
MsgBox 9223372036854775808 ; "-9223372036854775808" as expected
O := {}
O["9223372036854775808"] := "ANYTHING"
MsgBox O["9223372036854775808"] ; "ANYTHING" as expected
MsgBox O["-9223372036854775808"] ; Empty String as expected
for k, v in O
MsgBox k "," v ; "9223372036854775808,ANYTHING" as expected
O := {}
O[9223372036854775808] := "ANYTHING"
MsgBox O[9223372036854775808]
MsgBox O[-9223372036854775808]
MsgBox O["9223372036854775808"]
; We got three different results when run the code repeatly!
; 1:
; Nothing,Nothing,Nothing
; 2:
; Nothing,"ANYTHING",Nothing
; 3:
; "ANYTHING","ANYTHING",Nothing
for k, v in O
MsgBox k "," v ; "-9223372036854775808,ANYTHING" as expected
Code: Select all
O := {}
O[100] := "ANYTHING"
MsgBox O[100] ; "ANYTHING"
MsgBox O["100"] ; "ANYTHING"
Back to my preview problem:v2-changes wrote:As of v2.0-a067, numeric strings are converted to pure integers where possible without causing the kind of data loss described above.
Code: Select all
; Crashed sometimes with Exit code: 3221225477.
F := {"-2146826281" : "ANYTHING"}
MsgBox F["-2146826281"] ; SHOW EMPTY STRING
MsgBox F[-2146826281] ; SHOW EMPTY STRING
for k, v in F
MsgBox k "," v ; "-2146826281,ANYTHING" as expected.
Users browsing this forum: lexikos and 26 guests