Forum > Options

help:: what is the size of integer????

(1/1)

Charels:
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

Marc:
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})

Navigation

[0] Message Index

Go to full version