[fpc-pascal] LongInt and LongWord types
Sven Barth
pascaldragon at googlemail.com
Thu Jul 9 07:30:06 CEST 2020
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)),
> 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
): "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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20200709/f44d6a9e/attachment.htm>
More information about the fpc-pascal
mailing list