[fpc-pascal] Inline function parameters

Sven Barth pascaldragon at googlemail.com
Mon Nov 8 17:20:10 CET 2021


Ryan Joseph via fpc-pascal <fpc-pascal at lists.freepascal.org> schrieb am
Mo., 8. Nov. 2021, 15:31:

>
>
> > On Nov 8, 2021, at 1:27 PM, Sven Barth via fpc-pascal <
> fpc-pascal at lists.freepascal.org> wrote:
> >
> > And there you have it (simplified obviously). As long as the compiler
> can determine *at compile time* the code of the function (and the function
> is inlineable) it should in theory be able to inline it. This is true no
> matter if it's a function variable, a method variable (pointing to a
> non-virtual method) or an anonymous function. However if somewhere between
> passing in the function address and calling the function inlining does not
> work for one reason or the other (e.g. due to open array parameters which
> are currently not supported by inlining) then the compiler obviously can't
> inline the provided function either.
>
> Interesting, so the inlining the containing function is the key. I guess
> if the container were not inlined it would basically be like a generic
> where a new function body would be generated which contained the inline
> function pointers body with arguments replaced.
>

I don't know what you mean with "new function body". If a function is
inlined its code is contained within the surrounding function and if it's
not inlined then nothing changes.

Regards,
Sven
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20211108/96b9fc03/attachment.htm>


More information about the fpc-pascal mailing list