val integer overflow with hex numbers

  1. 6 days ago

    Christian S

    Apr 14 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    Today we run in a strange overflow issue.
    32-bit gives same result for each line:

    dim j as int64 = val("&hCCCCCCCC")
    dim n as int32 = val("&hCCCCCCCC")
    dim x as int32 = j

    MsgBox "j: "+str(j)+EndOfLine+"n: "+str(n)+EndOfLine+"x: "+str(x)

    But 64-bit will give wrong result for n.
    It's not the 64bit integer casted to integer, but gives max negative int.
    Please explain & document or fix.

    Anyone has a hint?

  2. Christian S

    Apr 14 Pre-Release Testers, Xojo Pro, XDC Speakers Germany

    Feedback Case #51891

  3. Derk J

    Apr 14 Pre-Release Testers, Xojo Pro
    Edited 6 days ago

    Val returns a double use integer.FromHex instead

    Dim j As In64 = Int64.FromHex(“CCCCCCCC”)

or Sign Up to reply!