[fpc-pascal] Comp type

Tony Whyman tony.whyman at mccallumwhyman.com
Wed Jan 10 16:22:44 CET 2018


Thanks for the history. Comp has always puzzled me before, especially 
with these two functions from the RTL

function MSecsToTimeStamp(MSecs: Comp): TTimeStamp;
function TimeStampToMSecs(const TimeStamp: TTimeStamp): comp;

I assume that these have come down from Turbo Pascal - but it still 
seems odd that milliseconds is represented by a "real" type.

Tony Whyman


On 10/01/18 08:04, Jonas Maebe wrote:
> Mattias Gaertner wrote:
>> Comp is Int64 div 10000.
> No, that is currency. Comp is a plain 64 bit integer. It originally
> comes from Turbo Pascal, which did not have a regular 64 bit integer
> type. The x87 fpu can be used to perform 64 bit integer math though, so
> it was originally a 64 bit integer type whose calculations were
> performed using the fpu.
>
> In FPC, it's the same on platforms that still use the x87 fpu. On other
> platforms, comp is an alias for the int64 type.
>
>
> Jonas
> _______________________________________________
> fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
> http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal
>




More information about the fpc-pascal mailing list