[fpc-pascal] Extended, Currency and TDateTime memory layout
parmaja at gmail.com
Sat Aug 7 22:44:38 CEST 2010
On Sat, Aug 7, 2010 at 9:56 PM, Felipe Monteiro de Carvalho <
felipemonteiro.carvalho at gmail.com> wrote:
> > A currency is a Int64, which is the currency amount multiplied by 10000.
> Well, apparently Delphi 6 RTTI thinks that it is a float. Check this code:
> 471 else if ElmTypeInfo.Kind in [tkFloat] then begin
> 472 case TypeData.FloatType of
> 473 ftSingle: Stream.Write(DynArray^, ArrayLength *
> 474 ftDouble: Stream.Write(DynArray^, ArrayLength *
> 475 ftComp: Stream.Write(DynArray^, ArrayLength *
> 476 ftCurr: Stream.Write(DynArray^, ArrayLength *
> 477 ftExtended: Stream.Write(DynArray^, ArrayLength *
> 478 end;
A Currency is a Int64 not float, if you assign currency to float variable
(double/extended) and return back to currency variable, you will not get the
Typecast the currency as Int64, assign it to int64 variable and vise versa
you will not lose any thing.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal