Author Topic: help:: what is the size of integer????  (Read 6670 times)


  • Guest
help:: what is the size of integer????
« on: July 15, 2005, 04:03:17 am »
I've installed the Lazarus 0.9.6 on a newly installed Red Hat.
I thought it was wrapped with fpc-1.9.8,
but I installed fpc-1.9.8 again.
I wrote a unit whose variables were all integers, and if I compiled
it under Emacs or shell while compiling another main
program, whose variables were also all declared integers,
 in Lazarus, I got an fatal error "Got 'Longint' but expected 'Smallint'".
If I changed all the integer into smallint in the main program
or click Build all, then I could get the 'successfully built' message.

I wonder why the sizeof integer in FPC and that in Lazarus integrated FPC
are different. How I can deal with them, I mean make them portable


  • Administrator
  • Hero Member
  • *
  • Posts: 2530
help:: what is the size of integer????
« Reply #1 on: July 15, 2005, 10:59:01 am »
If you use plain fpc, without specifying which mode it should use to compile a unit, it builds it in the fpc original mode. In that mode an integer is 16 bits. All Lazaus units define {$mode objfpc} in that mode integers are 32 bits (this also counts if you compile in delphi mode {$mode delphi})
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker


TinyPortal © 2005-2018