Modify

Opened 2 years ago

Last modified 9 months ago

#3717 assigned Bug

StringFormat doesn't format int64 integers correctly

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

Description

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)
Next

Attachments (0)

Change History (6)

comment:1 Changed 23 months ago by water

Tested with 3.3.15.0 - same problem.

comment:2 Changed 10 months ago by jchd18

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

comment:3 Changed 10 months ago by jchd18

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

comment:4 Changed 10 months ago by Jpm

in fact as the %p is not implemented under AutoIt the %s must be used to format ptr's

comment:5 Changed 10 months ago by Jpm

  • Owner set to Jon
  • Status changed from new to assigned

comment:6 Changed 9 months ago by Jpm

  • Owner changed from Jon to Jpm

Hi, Fix send to Jon

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

Action
as assigned The owner will remain Jpm.
Author


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

 
Note: See TracTickets for help on using tickets.