I want Integer, NOT the longint! (with Lazarus 0.9.28.2) lazarus / 11-Options ---------------------------------------------------------------------- xaero · 2010-05-23 01:49 Code: [Select]programe test; var a:integer; begin     a:=40000;     writeln(pred(a)); end. In Lazarus,this will output 39999!!! but actually "a" is an integer, can't take 40000! how to Correct it??? ---------------------------------------------------------------------- Ocye · 2010-05-23 02:33 An integer has no predefined size. FPC uses 32bit or 16bit (http://lazarus-ccr.sourceforge.net/docs/rtl/objpas/integer.html). If you want to ensure 16bit signed respectively a range from -32,768 to +32,767 use "smallint". http://en.wikipedia.org/wiki/Integer_%28computer_science%29 One punctuation mark is enough. ---------------------------------------------------------------------- marcov · 2010-05-23 06:23 Quote from: xaero on May 23, 2010, 03:49:33 amCode: [Select]programe test; var a:integer; begin     a:=40000;     writeln(pred(a)); end. In Lazarus,this will output 39999!!! but actually "a" is an integer, can't take 40000! Check your settings and compiler mode, and make sure it is a TP-like mode (TP or FPC), and not a delphi like mode that has integer=32-bit. (objfpc, delphi) I tested your code and prints [Turtle] ./test -25537 if compiled with the proper mode, ---------------------------------------------------------------------- xaero · 2010-05-23 20:49 Thanks ! and how to make FPC mode as the default setting? ---------------------------------------------------------------------- Leledumbo · 2010-05-24 00:02 Quoteand how to make FPC mode as the default setting?It's in compiler options. ---------------------------------------------------------------------- stonefull · 2010-05-24 09:35 Change mode on: {$mode fpc}{$H+} Code: [Select]program inteiro; {$mode fpc}{$H+}  // change mode here uses   {$IFDEF UNIX}{$IFDEF UseCThreads}   cthreads,   {$ENDIF}{$ENDIF}   Classes   { you can add units after this }; var   a: integer; {$R *.res} begin   a := 40000;   writeln(pred(a));   readln; end. ---------------------------------------------------------------------- marcov · 2010-05-24 14:43 FPC mode is the default, without $mode directives or -Sd/-S2 etc cmdline parameters ---------------------------------------------------------------------- xaero · 2010-05-24 19:10 Many thanks ! But in my Lazarus(v0.9.28.2), Object Pascal(-Mobjfpc) is the default! with Project --> Complier Option menu , I can set FPC(-Mfpc) as the current project's complier mode but when I create another new project, it automaticly changes to the default complier(-Mobjfpc)!!!! how to change the complier mode of  every project i create to FPC(-Mfpc)? (I don't like write the code "{$mode fpc}" etc in every project) ---------------------------------------------------------------------- mas steindorff · 2010-05-24 21:16 just so you know, you are going about this integer resizing all wrong.  the define of an integer is to be system and OS dependant.  it should change with the upcoming 64 bit OS.  it would be best to define a variable to be the size you wish like this Type   S8 = ShortInt;   U8 = byte;   chr8 = ANSIChar;  // or char   S16 = SmallInt;   U16 = word;   S32 = LongInt;   U32 = Cardinal;   F32 = single;   F64 = Double; Then you only have one place to change if any of the types get promoted. this type define can be inside some os dependant ifdefs as well for more portability ---------------------------------------------------------------------- skalogryz · 2010-05-25 00:07 Quote from: xaero on May 24, 2010, 09:10:35 pmhow to change the complier mode of  every project i create to FPC(-Mfpc)? (I don't like write the code "{$mode fpc}" etc in every project) It's not supported for now to select "a default mode". But you don't need to write {$mode fpc} in every unit or project. Just change the  Project -> Complier Options -> Syntax Mode option on each project created. The mode would be used for all compiled units (without explicit {$mode xxx} setting). ---------------------------------------------------------------------- marcov · 2010-05-25 04:02 Quote from: mas steindorff on May 24, 2010, 11:16:16 pm  it should change with the upcoming 64 bit OS.  (no it doesn't) ---------------------------------------------------------------------- xaero · 2010-05-25 06:13 thanks, Moderator thanks everyone ---------------------------------------------------------------------- genomega · 2010-06-05 14:51 Found this answer searching, thanks.