[fpc-pascal] Pass open array to static array?
pascaldragon at googlemail.com
Mon Mar 16 07:59:00 CET 2020
Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mo., 16. März 2020, 07:33:
> Ok, that makes sense now. Dynamic arrays can't be passed to static arrays.
> remember when I tried to make aligned dynamic arrays I got to look around
> the code and it seems plausible you could just make a memcpy call in the
> for dynamic arrays being passed to static arrays. Seems deceptively easy.
You forget managed types. You can't do a simple Move for them.
> Shouldn't it be a constant array though? I'm not sure how the compiler
> but from the programers perspective I thought I was getting something
> without runtime allocation because the array contained only constant
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
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.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the fpc-pascal