<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Hi Sven,</p>
<p>Am I right in thinking that, for C alignment, each field is
aligned according to its data size? For example, if you had:</p>
<p>TType = record<br>
Field1: Byte<br>
Field2: LongInt;<br>
end;</p>
<p>Are there are three unused bytes between Field1 and Field2 and
the structure as a whole is 8 bytes long and aligned to a 4-byte
boundary? I'm trying to find the page that explains all that, and
also exceptional cases where the data size is not necessary the
same as the minimum alignment.</p>
<p>Gareth aka. Kit<br>
</p>
<div class="moz-cite-prefix">On 02/04/2020 16:10, Sven Barth via
fpc-devel wrote:<br>
</div>
<blockquote type="cite"
cite="mid:CAFMUeB98b53vq-_nJP+BnvFW+Ji_sycAEub4+nzsUwYEO=pESw@mail.gmail.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div dir="auto">
<div>
<div class="gmail_quote">
<div dir="ltr" class="gmail_attr">J. Gareth Moreton <<a
href="mailto:gareth@moreton-family.com"
moz-do-not-send="true">gareth@moreton-family.com</a>>
schrieb am Do., 2. Apr. 2020, 15:25:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">For
standard record types (no "packed" modifier or compiler
directives <br>
or anything), I'm wondering how many liberties that the
compiler is <br>
allowed to take in storing its data. Take the following
example (from <br>
raybench.pas over here: <a
href="http://runtimeterror.com/tools/raybench"
rel="noreferrer noreferrer" target="_blank"
moz-do-not-send="true">http://runtimeterror.com/tools/raybench</a>
):<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">With no explicit packing specified the compiler
in general follows the platform's C compiler for compatibility
reasons. </div>
<div dir="auto"><br>
</div>
<div dir="auto">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">P.S. Of
course you can force it by forcing the vector to be an
m128 type <br>
and specifying vectorcall for x86_64-win64, but not
everyone will know <br>
to do that and it gets unwieldly rather quickly. Speaking
of <br>
vectorcall, I'm wondering if we can introduce 'fastcall'
as an alias for <br>
'ms_abi_default', mostly so if we follow Microsoft Visual
C++'s example <br>
of automatically making all routines vectorcall (which is
closer to the <br>
System V ABI used by linux and will make vectorisation
easier), we can <br>
force the default one if we need a routine that, say, has
to interface <br>
with a third-party library ('fastcall' under win32 is what
the MS ABI is <br>
based off... first parameter in ECX, second in EDX and
everything else <br>
on the stack).<br>
</blockquote>
</div>
</div>
<div dir="auto"><br>
</div>
<div dir="auto">Please provide a source for your statement that
MSVC uses vectorcall by default. Cause I highly doubt that as
Microsoft is huge on backwards compatibility especially
regarding the lower level stuff. </div>
<div dir="auto"><br>
</div>
<div dir="auto">Regards, </div>
<div dir="auto">Sven </div>
<div dir="auto">
<div class="gmail_quote">
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
fpc-devel maillist - <a class="moz-txt-link-abbreviated" href="mailto:fpc-devel@lists.freepascal.org">fpc-devel@lists.freepascal.org</a>
<a class="moz-txt-link-freetext" href="https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel">https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel</a>
</pre>
</blockquote>
<div id="DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2"><br />
<table style="border-top: 1px solid #D3D4DE;">
<tr>
<td style="width: 55px; padding-top: 13px;"><a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank"><img src="https://ipmcdn.avast.com/images/icons/icon-envelope-tick-round-orange-animated-no-repeat-v1.gif" alt="" width="46" height="29" style="width: 46px; height: 29px;" /></a></td>
<td style="width: 470px; padding-top: 12px; color: #41424e; font-size: 13px; font-family: Arial, Helvetica, sans-serif; line-height: 18px;">Virus-free. <a href="https://www.avast.com/sig-email?utm_medium=email&utm_source=link&utm_campaign=sig-email&utm_content=emailclient" target="_blank" style="color: #4453ea;">www.avast.com</a>
</td>
</tr>
</table><a href="#DAB4FAD8-2DD7-40BB-A1B8-4E2AA1F9FDF2" width="1" height="1"> </a></div></body>
</html>