Re: 64 bit data types



Kristofer Skaug wrote:
Florent Ouchet wrote:
Cardinal (64 bit signed)
64 bit unsigned

Speaking of which, what's the deal with the 'hidden' UInt64 type in Delphi, anyway?
Last time I checked (D2005 trial, IIRC) it didn't behave much like a real unsigned 64-bit int.



Well, it's mostly usable, I'd say. IntToStr() will still consider the integer as signed, but... it's getting there. <g>

There has been at least one improvement with BDS2006 update 1;
the following code now doesn't compile:

	var Big: UInt64;
	...
	Big := $FFFFFFFFFFFFFFF0;
	Writeln(IntToHex(Big, 16));

How is that an improvement, you ask? When it did, the output was
00000000FFFFFFF0 (ouch). The old workaround is still valid:

function IntToHex(const BigInt: UInt64; const Digits: Integer): string; overload; inline;
begin
Result := IntToHex(Int64(BigInt), Digits);
end;
.