Opened 14 months ago

Last modified 14 hours ago

#3717 new Bug

StringFormat doesn't format int64 integers correctly

Reported by: jchd18 Owned by:
Milestone: Component: AutoIt
Version: Severity: None
Keywords: Cc:


The code below returns invalid results due to %i, %d and %u specifiers being limited to 32-bit integers.

Local $b = [["2^31-1", 2^31-1], ["2^31  ", 2^31], ["2^32-1", 2^32-1], ["2^32  ", 2^32], ["2^33  ", 2^33]], $s, $n

For $i = 0 To UBound($b) - 1
	$s = $b[$i][0]
	$n = $b[$i][1]
	ConsoleWrite(StringFormat("%-14s%-6s%12i", $s & "  [%i]", VarGetType($n), $n) & (StringFormat("%i", $n) = $n ? "" : "  should be  " & $b[$i][1]) & @LF)
	ConsoleWrite(StringFormat("%-14s%-6s%12u", $s & "  [%u]", VarGetType($n), $n) & (StringFormat("%u", $n) = $n ? "" : "  should be  " & $b[$i][1]) & @LF & @LF)

Attachments (0)

Change History (3)

comment:1 Changed 13 months ago by water

Tested with - same problem.

comment:2 Changed 14 hours ago by jchd18

  • Summary changed from StringFormat don't format int64 integers correctly to StringFormat doesn't format int64 integers correctly

comment:3 Changed 14 hours ago by jchd18

Even in X64 Stringformat is limited to 32-bit values, making it unable to format 64-bit pointers.

Guidelines for posting comments:

  • You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
  • In-depth discussions should take place on the forum.

For more information see the full version of the ticket guidelines here.

Add Comment

Modify Ticket

as new The ticket will remain with no owner.

E-mail address and user name can be saved in the Preferences.

Note: See TracTickets for help on using tickets.