[fpc-devel] Concatenating huge AnsiStrings

Michalis Kamburelis michalis.kambi at gmail.com
Tue Jul 2 13:30:06 CEST 2024


> Delphi also decided to follow the LP64 vs LLP64 rules regarding the Integer type (it's 32-bit on 64-bit Windows, but 64-bit on 64-bit macOS and Linux) while we decided to keep the size of Integer at 32-bit on 32- and 64-bit systems.

Just a clarification to this statement about Delphi: In Delphi the
size is inconsistent for LongInt and LongWord. They are 32-bit on
32-bit platforms and (as a special exception) they are also 32-bit on
64-bit Windows platforms . They are 64-bit everywhere else. Yes, this
is a bit crazy (I'm thankful FPC didn't follow this inconsistent
rule). For me, in practice this means you should not use LongInt /
LongWord for code that should be cross-platform and Delphi-compatible,
because LongInt / LongWord size is so weirdly defined that it invites
bugs IMHO.

The Integer / Cardinal size remains always 32-bit, in both Delphi and FPC.

See https://castle-engine.io/coding_conventions#no_longint_longword ,
see our testcase
https://github.com/castle-engine/castle-engine/blob/6164c2645fe522751fe7ff48080d07f88c1df5c4/tests/code/testcases/testcompiler.pas#L115-L116
(that is checked with all FPC and Delphi versions we support, so also
Delphi on Linux).

Regards,
Michalis


More information about the fpc-devel mailing list