<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<div class="moz-cite-prefix">Am 08.07.2020 um 23:00 schrieb Marcelo
Rocha via fpc-pascal:<br>
</div>
<blockquote type="cite"
cite="mid:CABREtENJwYm_SEVgETMJxpAt4fgSPW2FfJ3=SBbisU32sq-XFA@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="ltr">
<div>Delphi's LongInt and LongWord are 32 bits on Windows, but
64 bits on supported Posix platforms(<a
href="http://docwiki.embarcadero.com/RADStudio/Rio/en/Simple_Types_(Delphi)"
moz-do-not-send="true">http://docwiki.embarcadero.com/RADStudio/Rio/en/Simple_Types_(Delphi)</a>),
following the conventions from LP64/LLP64. FreePascal declares
with the same size for all platforms. <br>
</div>
<div><br>
</div>
<div>What's the best way to do portable code: using types clong
and culong?</div>
</div>
</blockquote>
<br>
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).<br>
<br>
<blockquote type="cite"
cite="mid:CABREtENJwYm_SEVgETMJxpAt4fgSPW2FfJ3=SBbisU32sq-XFA@mail.gmail.com">
<div dir="ltr">
<div><br>
</div>
<div>FreePascal could emit a warning when compiling a code with
Longint/Longword variables, targeting a Posix platform, with
{$mode delphi}? <br>
</div>
</div>
</blockquote>
<br>
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.<br>
What there is, is a remark in the documention (in
<a class="moz-txt-link-freetext" href="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</a>
): "<span class="cmbx-10">Remark</span> In newer Delphi versions,
the <span class="cmtt-10">longint </span>type is platform and CPU
dependent. This is not so in
FPC, where longint is 32-bit on all platforms."<br>
<br>
Regards,<br>
Sven<br>
</body>
</html>