<div dir="auto"><div><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Ryan Joseph via fpc-pascal <<a href="mailto:fpc-pascal@lists.freepascal.org">fpc-pascal@lists.freepascal.org</a>> schrieb am Mo., 16. März 2020, 07:33:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Ok, that makes sense now. Dynamic arrays can't be passed to static arrays. I<br>
remember when I tried to make aligned dynamic arrays I got to look around in<br>
the code and it seems plausible you could just make a memcpy call in the RTL<br>
for dynamic arrays being passed to static arrays. Seems deceptively easy. :)<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">You forget managed types. You can't do a simple Move for them. </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">
<br>
Shouldn't it be a constant array though? I'm not sure how the compiler works<br>
but from the programers perspective I thought I was getting something<br>
without runtime allocation because the array contained only constant values.<br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">It's only a constant array if it's declared in the const section. Inside normal code it can also contain variables, function calls, just any expression really. </div><div dir="auto"><br></div><div dir="auto">Though it would be a potential optimization if all entries are constant to treat it as a constant array. Again that is something that *could* be done, but is not right now. </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>