Watch, Follow, &
Connect with Us
Public Report
Report From: Delphi-BCB/RTL/Delphi/Format + Float    [ Add a report in this area ]  
Report #:  56502   Status: Closed
IntToStr doesn't support UInt64
Project:  Delphi Build #:  11.0.2902.10471
Version:    11.2 Submitted By:   Jordan Russell
Report Type:  Basic functionality failure Date Reported:  1/1/2008 2:50:00 PM
Severity:    Commonly encountered problem Last Updated: 3/20/2012 2:24:39 AM
Platform:    All versions Internal Tracking #:   257020
Resolution: As Designed (Resolution Comments) Resolved in Build: : 14.0.3513.24210
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 16
Description
IntToStr returns unexpected/bogus results when passed a UInt64 type.

Solution:
Add a third overloaded version of IntToStr:

function IntToStr(Value: UInt64): string;
begin
  FmtStr(Result, '%u', [Value]);
end;

(Note: The compiler overloading bug reported in #56504 may have to be fixed first.)
Steps to Reproduce:
var
  U: UInt64;
begin
  U := 100000000000;
  Writeln(IntToStr(U));
  U := High(U);
  Writeln(IntToStr(U));
end.


Expected result:

100000000000
18446744073709551615

Actual result:

1215752192
-1
Workarounds
None
Attachment
None
Comments

Paul McBryde at 12/2/2008 3:38:14 PM -
This is also a problem in C++ Builder 2009.

Tomohiro Takahashi at 12/4/2008 1:07:46 AM -
Yes, this issue still Open.

Server Response from: ETNACODE01