Recent

Author Topic: Comp as LargeInt  (Read 2008 times)

TheNick

  • New Member
  • *
  • Posts: 24
  • Pax vobiscum
Comp as LargeInt
« on: August 06, 2021, 11:59:19 am »
When using below code in MS Windows it compiles fine and runs the software. But when compiling in Linux (Mint 20.2) it fails to compile with:

"Incompatible type for arg no. 1: Got "Comp", expected "Int64"

From what I have understood the type "Comp" is defined as an Int64 (according to the reference for the unit 'System')

Anyone that has a hunch about what I have misunderstood?

Code: Pascal  [Select][+][-]
  1. var
  2. TimeStamp: Comp;
  3.  
  4. begin
  5. TimeStamp:=TimeStampToMSecs(DateTimeToTimeStamp(now));
  6. .
  7. .
  8. .
  9. XXXX.FieldByName('created_at').AsLargeInt:=TimeStamp;
  10. .
  11. .
  12.  
  13.  


//Niclas
Never give up, never surrender! 😃

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11383
  • FPC developer.
Re: Comp as LargeInt
« Reply #1 on: August 06, 2021, 12:28:05 pm »
On some targets using x87 FPU, comp is the x87 FPU comp type.

Win64 uses SSE for fpu afaik per Microsoft decree, and *nix uses x87.

In general, it is best to simply never use comp. It is a legacy type that is best forgotten.
« Last Edit: August 06, 2021, 12:37:45 pm by marcov »

Thaddy

  • Hero Member
  • *****
  • Posts: 14205
  • Probably until I exterminate Putin.
Re: Comp as LargeInt
« Reply #2 on: August 06, 2021, 03:23:52 pm »
Addition to Marco:
https://www.freepascal.org/docs-html/3.0.0/ref/refsu6.html

It is also not portable.
Specialize a type, not a var.

 

TinyPortal © 2005-2018