[fpc-pascal] LongInt and LongWord types

Vojtěch Čihák vojtech.cihak at atlas.cz
Thu Jul 9 12:23:09 CEST 2020


I suspect Embarcadero that they often intently design Delphi to be not compatible with FPC.
V.
______________________________________________________________
> Od: "Sven Barth via fpc-pascal" <fpc-pascal at lists.freepascal.org>
> Komu: fpc-pascal at lists.freepascal.org
> Datum: 09.07.2020 07:30
> Předmět: Re: [fpc-pascal] LongInt and LongWord types
>
Am 08.07.2020 um 23:00 schrieb Marcelo Rocha via fpc-pascal:Delphi's LongInt and LongWord are 32 bits on Windows, but 64 bits on supported Posix platforms(http://docwiki.embarcadero.com/RADStudio/Rio/en/Simple_Types_(Delphi) <http://docwiki.embarcadero.com/RADStudio/Rio/en/Simple_Types_(Delphi)>), following the conventions from LP64/LLP64. FreePascal declares with the same size for all platforms. What's the best way to do portable code: using types clong and culong?
 Best declare your own aliases with the help of some ifdefs (clong/culong don't exist in Delphi, so you'd have to declare aliases anyway).
 
FreePascal could emit a warning when compiling a code with Longint/Longword variables, targeting a Posix platform, with {$mode delphi}? 
 LongInt and LongWord are the *base* types used by FPC. So *everything* is using them, because Integer and Cardinal are merely aliases. Not to mention that FPC has provided 64-bit support first on Posix platforms way back and for that is was decided to keep the size of LongInt and LongWord the same on all platforms for consistency. This will not be changed and there won't be a warning for that.
 What there is, is a remark in the documention (in https://www.freepascal.org/docs-html/current/ref/refsu4.html#x26-250003.1.1 <https://www.freepascal.org/docs-html/current/ref/refsu4.html#x26-250003.1.1> ): "Remark In newer Delphi versions, the longint type is platform and CPU dependent. This is not so in FPC, where longint is 32-bit on all platforms."
 
 Regards,
 Sven
 
 
 ----------
 
 _______________________________________________
 fpc-pascal maillist  -  fpc-pascal at lists.freepascal.org
 https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal <https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200709/79aa9f2b/attachment.htm>


More information about the fpc-pascal mailing list